FileFlush
Description
Flush any kernel-side buffering for the file. On POSIX with no user-side buffering this is a no-op success unless the platform needs an fsync (we don’t fsync today; callers that need durable writes should fsync the fd themselves). On Windows it calls FlushFileBuffers.
Success
Returns true.
Failure
Returns false.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
File.c:346:
}
bool FileFlush(File *f) {
if (!FileIsOpen(f)) {
return false;- In
Io.c:548:
}
if (ok && !FileFlush(stream)) {
LOG_ERROR("Failed to flush formatted output");
ok = false;- In
File.c:1063:
// truthy would make the closed case wrongly report success.
bool test_fm_347_flush_open_vs_closed(void) {
WriteFmt("Testing FileFlush returns true open / false closed (open gate)\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
File.c:1075:
}
// Open handle flushes true.
bool ok = (FileFlush(&f) == true);
FileClose(&f);
// Closed handle must flush false (the open gate fires).
- In
File.c:1078:
FileClose(&f);
// Closed handle must flush false (the open gate fires).
ok = ok && (FileFlush(&f) == false);
FileRemove(&path);
Last updated on