From: Ferry H. <fer...@gm...> - 2006-11-20 20:51:27
|
Ian, Glad to hear you're happy with the contributions! As you note below, some kind of "clear" (or reset) operation for files sounds good. Maybe it should simply truncate an already open file? For example: open(filename) reset() <-- truncates file write(string) <-- writes to the start of the file Comments? Cheers /Ferry On 11/21/06, Ian Larsen <dr...@gm...> wrote: > Ferry, > > I've added the file access from your branch with the following changes: > > - Removed "mode" support. I think this will be confusing for kids. > Files are all open read/write. > > - Removed error return code. File errors halt execution with an error > in the text output window. EOF's returns a blank string, so you can > check for end of file conditions that way. > > - All writes are appended to the end of the file, after which file > position is returned to the previous position for reading. This way > data isn't ever overwritten, but reads still occur sequentially, which > I think will be the most intuitive for new programmers. > > I think this will be the easiest method for file I/O for kids. We > might want to consider a fileClear function to wipe a file clean, so > new data can be written. > > I'll be making a new release soon with these new features. Thanks to > all for the excellent work. I really appreciate the help with this, > and it's coming along much faster and better than I could do myself. > > -Ian > > > > On 11/19/06, Ferry Hendrikx <fer...@gm...> wrote: > > All done and committed to the repository (rev 134). We now have 4 file > > operations: > > > > - int open(string name, string mode) > > - mode can be one of "read" or "write", defaulting to "read". > > > > - string read() > > - read one token from the file > > > > - int write(string token) > > - write one token to the file > > > > - int close() > > - close the file > > > > Cheers > > > > /Ferry |