FileIsEOF()
Determines whether Lucee has reached the end of the file while reading it.
FileIsEOF( file=any );
Returns: Boolean
Examples
filePath = "/path/to/file.txt"
openFile = fileopen(filePath, "read");
lines = [];
// IMPORTANT: must close file, use try/catch/finally to do so
try {
// fileIsEOF(openFile) == false until we've read in the last line.
while( !fileIsEoF(openFile) ) {
arrayAppend(lines, fileReadLine( openFile ));
}
} catch(any e) {
rethrow;
} finally {
fileClose(openFile);
}
See also
- File handling
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)