From: Ferry H. <fer...@gm...> - 2006-11-17 00:11:29
|
I definitely agree that we want to avoid the classic basic approach. The FOPEN (and others) approach is reasonable and we should probably be working at the character level, as dealing with UTF-8 etc would be a real pain... We could take a C-like approach and have a gets(number) function? e.g. returns <number> characters in a string from the currently open file (until end of line?) Hmm.. also, do we want to support one open file or more than one? Cheers /Ferry On 11/17/06, Ian Larsen <dr...@gm...> wrote: > Actually, I haven't given it much thought, but you're right, it would > be good to have that. > > We could have an FOPEN, FREAD, and FWRITE command. I'm just unsure of > whether they should work at the byte or character level. > > What I usually do is write an example program or tutorial first, and > then code the commands. It helps to focus on what is actually > necessary to teach kids. > > Traditionally BASIC used READ and DATA statements for data input, but > personally I was never crazy about that approach, most importantly > because I think data should be a separate entity from the program that > reads/alters it. > > The approach that LISP takes for file input is nice. You can use the > lisp read command on an open file to read a token, or read-line to > read a line. There's also read-char and read-byte. This might be the > best way to handle it, so kids can have a text file of data separated > by white space and just read each token in one at a time. > > -Ian > > > > > On 11/16/06, Ferry Hendrikx <fer...@gm...> wrote: > > Has anyone given any thought to file access? It would be useful to be > > able to open, read and write text files... > > > > Cheers > > > > /Ferry > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share your > > opinions on IT & business topics through brief surveys - and earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Kidbasic-devel mailing list > > Kid...@li... > > https://lists.sourceforge.net/lists/listinfo/kidbasic-devel > > > |