-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a example for FileIsEOF() function
- Loading branch information
Showing
1 changed file
with
16 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
*There are currently no examples for this function.* | ||
```luceescript | ||
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); | ||
} | ||
``` |