Sunday, September 4, 2011

I/O Library is checked in

Well, better late than never...

There are now low-level classes for reading/writing to files, standard in/out, and to memory. There are also reader classes for reading and writing text:

tart.io.Console
tart.io.FileStream
tart.io.MemoryStream
tart.io.StreamTextReader
tart.io.StreamTextWriter

...plus a host of unit tests to go along with them. I don't yet have "convenience methods" for opening text files, so for now the easiest way to read from a file is:

let reader = StreamTextReader(FileStream(filename))
for line in reader {
  // do something with 'line'.
}
reader.close();

No comments:

Post a Comment