fflush
Function Prototype
int fflush(FILE *fp)Function
- Any unwritten data in the stream (buffer) are passed to the kernel (buffer cache)
- All output stream are flushed if
fp == NULL
Warning
- Since
fflushpass data to buffer cache and not disk, we might need to call fsync to actually do disk I/O - Calling
fsyncwithout callingfflushmight do nothing if all data are still in the user space buffer instead of kernel space buffer cache