FileReadLine()
Reads the current line from an open file (see FileOpen()) and moves the current line pointer of the file to the next line.
FileReadLine( file=any );
Returns: String
Examples
// Example reads lines of file one at a time into an array
filePath = "/path/to/file.txt"
openFile = fileopen( filePath, "read" );
lines = [];
// IMPORTANT: must close file, use try/catch/finally to do so
try {
while( !fileIsEoF( openFile ) ) {
arrayAppend( lines, fileReadLine( openFile ) );
}
} catch( any e ) {
rethrow;
} finally {
fileClose( openFile );
}
See also
- File handling
- FileOpen()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)