Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!news.ultranet.com!news.sprintlink.net!cs.utexas.edu!news.ti.com!ticipa!clw
From: clw@ticipa.pac.sc.ti.com (Chris Winemiller)
Subject: Re: how to read a file in smalltalk
Message-ID: <1995Mar15.174543.12004@ticipa.pac.sc.ti.com>
Organization: None
References: <3k5kk5$3rb@panix.com>
Date: Wed, 15 Mar 1995 17:45:43 GMT
Lines: 25

In article <3k5kk5$3rb@panix.com> pma@panix.com (Patrick Ma) writes:
>I am trying to read in a text file and display it in a TextPane using
>Smalltalk/V. I read in the tutorial that I can use input := File
>pathName: 'myfile.txt'. However, this assumes that myfile is in the
>current directory. So, I thought I would try using a windows standard
>open dialog box to get a file. This way, I am not limited to files in my
>current directory. I used
>
>	input := FileDialog new openFile file.
>
>Now, input contains the whole pathname + filename. My problem is how do
>I create a filestream out of input.

    fileName := FileDialog new openFile file.
    inputStream := File pathNameReadOnly: fileName.

inputStream is a FileStream which lets you read your file. (I show it
created as a "read only" FileStream, assuming you only wanted to
retrieve the file's contents rather than alter it.)

Chris
==============================================================
Chris Winemiller               Internet: clw@works.ti.com
Disclaimer: I do not speak for TI.
==============================================================
