fileIsEOF
Client-side
Server-side
Shared
Checks if the file position is at the end of the file.
Caution
Due to underlying C API restrictions this function may return false until an attempt to read further than the end of the file is made.
OOP Syntax Help! I don't understand this!
- Method:file:isEOF(...)
- Variable: .eof
Syntax
bool fileIsEOF ( file theFile )Required arguments
- theFile: A handle to the file you wish to check.
Returns
Returns true if the file position of the specified file is at the end of the file, false otherwise.
- bool: result
Code Examples
shared
This example opens the file test.txt and outputs its contents to the console.
local hFile = fileOpen("test.txt", true) -- attempt to open the file (read only)if hFile then -- check if it was successfully opened local buffer while not fileIsEOF(hFile) do -- as long as we're not at the end of the file... buffer = fileRead(hFile, 500) -- ... read the next 500 bytes... outputConsole(buffer) -- ... and output them to the console end fileClose(hFile) -- close the file once we're done with itelse outputConsole("Unable to open test.txt")end