2

This is simple GNU Smalltalk question. Sorry, but just could not find how to do this.

I'm playing with gnu smalltalk, I know I can do

% gst <file-name>

but if I already in gst> prompt, how can I read a file into memory (file that contains code), something like TCL source command.

thanks and applogies again for the simple question.

OscarRyz
  • 196,001
  • 113
  • 385
  • 569
eran
  • 6,731
  • 6
  • 35
  • 52

3 Answers3

3

Use a package?

Stephan Eggermont
  • 15,847
  • 1
  • 38
  • 65
1

you can use class FileStream, whose superclass is FileDescriptor belonged to Streams-Files.

May the link below help you

http://www.gnu.org/software/smalltalk/manual-base/gst-base.html#FileStream

here is a sample code:

at: #f put: (FileStream  open: '/root/test'  mode: FileStream read) !
f do: [ :c | Transcript nextPut: c ] !
25 timesRepeat: [ Transcript nextPut: (f next) ] ! 
f close !
Frank Shearar
  • 17,012
  • 8
  • 67
  • 94
parsifal
  • 879
  • 4
  • 12
  • 21
1

You can use:

st> fd := FileDescriptor open: './myfile.st'
<FileDescriptor on "/Users/math/myfile.st">
st> fd fileIn
mathk
  • 7,973
  • 6
  • 45
  • 74