FileIsEOF()
Determines whether Lucee has reached the end of the file while reading it.
FileIsEOF( file=any );
Returns: Boolean
| Argument | Description |
|---|---|
|
file
any,
required
|
edit
The file object. Alias: source, filePath |
Examples
editfilePath = "/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 open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)