Flushes data all the way to the disk. Format #include <unistd.h> int fsync (int fd);
1 – Argument
fd A file descriptor corresponding to an open file.
2 – Description
The fsync function behaves much like the fflush function. The primary difference between the two is that fsync flushes data all the way to the disk while fflush flushes data only as far as the underlying RMS buffers. Also, with fflush, you can flush all buffers at once; with fsync you cannot.
3 – Return Values
0 Indicates successful completion. -1 Indicates an error.