检查文件指针是否已到达文件末尾。
eof()
示例
逐行读取文件直至结束。
javascript function main() { let file = os.open("data.txt", "r") let lineCount = 0 while (!file.eof()) { let line = file.getline() if (line) { lineCount++ Log("Line", lineCount + ":", line) } } Log("Total lines:", lineCount) file.close() }
返回值
bool
如果已到达文件末尾返回true,否则返回false。
参考
close puts printf flush tell seek eof read write getline toString
close
puts
printf
flush
tell
seek
eof
read
write
getline
toString
备注
用于在读取文件时判断是否已读取完所有内容。