FILE_EOF()

FILE_EOF(N)

RETURNS 1 IF THE CURRENT POSITION IS BEYOND THE LAST CHARACTER OF THE TEXT FILE NUMBER N, 0 OTHERWISE

  • Type: Function
  • Parameter: 1
  • Group: Text Files

ACTION

The fonction FILE_EOF(N) returns 1 if the current file position is beyond the last character of the text file number N or if the file is empty, 0 otherwise.

SYNTAX: Result=FILE_EOF(N)

  • N = text file number (integer or real). Must be greater than 0 and less than or equal to the maximum of allowed text file number.

USE

  • The function FILE_EOF() is used to know if the end of a text file is reached.

ERROR

  • If number N is not a correct expression.
  • If number N exceeds the maximum of allowed text file number.
  • If number N is not used for an open text file.

EXAMPLE

dim a$

rem open a text file for reading

file_open_read 1,"my_file.txt"

rem print all its lines

while file_eof(1) <> 1

file_readln 1,a$:print a$

end_while

rem close it

file_close 1

SEE ALSO

FILE_CLOSE

FILE_OPEN_APPEND

FILE_OPEN_READ

FILE_OPEN_WRITE

FILE_READ

FILE_READBUF

FILE_READLN

FILE_READLN$()

FILE_WRITE

FILE_WRITEBUF

FILE_WRITELN