[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading a file in Applesoft



LOL - I seem to remember the best way to do this is to setup an onerr...
like

5 onerror goto 9999

That's the dirty way to do it

There's a list of error codes and one of those is an EOF as opposed to ^C or
Syntax, etc... you /could/ goto 9000 and at 9000 decode the errors there and
simply check if it's an EOF, goto 9999, but if it was a different error then
EOF, you would probably /want/ to close the file anyways, then deal with
that error.

It's cheap - It's dirty - but it should work.


--
DJ (House of Usher, Europa, Black Lodge)
Film, Rich Media, MultiMedia Scoring
http://www.cyberden.com/bat

"ralmin" <sbiber@optushome.com.au> wrote in message
news:BP7m7.3527$Tv6.17984@news1.rdc1.nsw.optushome.com.au...
> I want to read a file character-by-character.
>
> Eg.
> 10 D$=CHR$(4)
> 20 INPUT "Filename? ";F$
> 30 PRINT D$;"OPEN ";F$
> 40 PRINT D$;"READ ";F$
> 50 IF (end of file) THEN GOTO 9999
> 60 GET A$
> etc.
> 100 GOTO 50
> 9999 PRINT D$;"CLOSE"
>
> How can I tell when I've got to the end of the file so I can jump out and
> close the file instead of getting an END OF DATA error?
>
> Ralmin.
>
>