[Gambas-user] EOF problem
Doriano Blengino
doriano.blengino at ...1909...
Sun Apr 18 20:16:48 CEST 2010
Les Hardy ha scritto:
> Hi Ed,
> I figured it out.
> First of all, depending how the text file was emptied/created, the
> contents may not be truely empty.
> Gedit for example leaves the 0A (end-of-line) character in the 'empty'
> file. This is recognised by eof() as a character, so, end-of-file is not
> found.
> I am not sure if this can be considered a bug in Gambas, but it does
> mean an eof() is only good for preventing read errors, and is not
> reliable for testing if a file is empty.
>
Just breaking in to say that a file with a EOL in it is not an empty
file - it is a file with an empty line in it...
Given such a file, at first EOF is false; doing a LINE INPUT an empty
line is read, then EOF turns true. Or, at least, it should go this way.
Regards,
--
Doriano Blengino
"Listen twice before you speak.
This is why we have two ears, but only one mouth."
More information about the User
mailing list