Type/to search
Built-in Functions
Global
Version
IsVirtual
GetOS
GetPid
GetMeta
Sleep
Unix
UnixNano
_D
GetCommand
GetLastError
SetErrorFilter
_N
_C
_Cross
JSON.parse
JSON.stringify
Encode
MD5
UUID
Log
Market
Trade
Account
Futures
Exchange
IO
Network
Storage
Threads
TA
Talib
Overlap Studies
Momentum Indicators
Volume Indicators
Volatility Indicators
Cycle Indicators
Price Transform
Statistic Functions
Math Transform
Math Operators
Pattern Recognition
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

Check if the file pointer has reached the end of file.

eof()

Examples

Read file line by line until end of file.

javascript
function main() { let file = os.open("data.txt", "r") let lineCount = 0 while (!file.eof()) { let line = file.getline() if (line !== undefined) { lineCount++ Log("Line", lineCount + ":", line) } } Log("Total lines:", lineCount) file.close() }

Returns

TypeDescription

bool

Returns true if end of file has been reached, otherwise returns false.

See Also

Remarks

Used to determine whether all content has been read when reading a file. It returns true only after a read has hit the end of file, e.g. getline() returned undefined, read(size) got no data, or read() without arguments read the rest of the file; seek() resets it to false.