FileIsEof
Description
Check whether a previous FileRead reported end-of-file.
Success
Returns true when the last read returned 0 bytes.
Failure
Returns false otherwise. Cannot fail.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
File.c:360:
}
bool FileIsEof(const File *f) {
return f && f->at_eof;
}- In
File.c:229:
// A zero-byte request returns 0 and must NOT flag eof.
char scratch[4] = {0};
ok = ok && (FileRead(&f, scratch, 0) == 0) && !FileIsEof(&f);
// Drain the 2 bytes of content.
- In
File.c:232:
// Drain the 2 bytes of content.
ok = ok && (FileRead(&f, scratch, 2) == 2) && !FileIsEof(&f);
// The next read hits EOF: 0 bytes, eof flag set.
- In
File.c:235:
// The next read hits EOF: 0 bytes, eof flag set.
ok = ok && (FileRead(&f, scratch, 2) == 0) && FileIsEof(&f);
FileClose(&f);- In
File.c:647:
ok = ok && FileIsOpen(&f);
char buf[4] = {0};
ok = ok && (FileRead(&f, buf, 2) == 2) && !FileIsEof(&f);
// The next read hits EOF: 0 bytes and at_eof becomes true.
ok = ok && (FileRead(&f, buf, 2) == 0) && FileIsEof(&f);- In
File.c:649:
ok = ok && (FileRead(&f, buf, 2) == 2) && !FileIsEof(&f);
// The next read hits EOF: 0 bytes and at_eof becomes true.
ok = ok && (FileRead(&f, buf, 2) == 0) && FileIsEof(&f);
FileClose(&f);- In
File.c:682:
// Drain to EOF to set at_eof.
ok = ok && (FileRead(&f, buf, 6) == 6);
ok = ok && (FileRead(&f, buf, 2) == 0) && FileIsEof(&f);
// Seek back to start: returns offset 0 and clears the eof flag.
- In
File.c:686:
// Seek back to start: returns offset 0 and clears the eof flag.
ok = ok && (FileSeek(&f, 0, FILE_SEEK_SET) == 0);
ok = ok && !FileIsEof(&f);
// And reading now succeeds again from the top.
char buf2[3] = {0};
Last updated on