File.sync

void sync() @trusted

Forces any data buffered by the OS to be written to disk. Call flush before calling this function to flush the C FILE buffers first.

This function calls

FlushFileBuffers on Windows, F_FULLFSYNC fcntl on Darwin and fsync on POSIX for the file handle.

Throws

Exception if the file is not opened or if the OS call fails.