FEOF
Function FEOF( file index )
Returns a non zero value if the file represented by file index is at end-of-file.
Syntax IF FEOF( 1 ) THEN PRINT "End of file"
Remarks
file index is the index to a file previously opened by a successful call to FOpen .
FEOF is most commonly used as a test condition for control constructs such as While-Wend.
It can be used in the form !FEOF( file index ) to tell when end-of-file has been reached.
See the example script below.
See Also:
FGets FGetc FOpen FSeek FTell File and Directory functions
Example Script
NUMBER x = 1
STRING a = "*.txt"
a = FINDFIRST(a)
WHILE LEN(a)
FOPEN(x,a) ' x contains 1 on the first pass
a = FINDNEXT()
WHILE NOT FEOF(x) ' print the contents of each matching file.
PRINT FGETS(x)
WEND
FCLOSE(x)
WEND
Script Output
(your results may be different - this is the content of a script file found in the directory!)
IF CHDIR("C:\Temp") THEN
PRINT CWD()
ELSE
PRINT "Directory not found."
ENDIF
NUMBER i,j
' let's print the ASCII chart (this might get messy).
FOR i = 0 TO 15
FOR j = 0 TO 15
PRINT CHR(i * 15 + j);
NEXT
NEXT