This documentation is archived and is not being maintained.


Flushes a file directly to disk.

int _commit( 
   int fd 


File descriptor referring to open file.

Return Value

_commit returns 0 if the file was successfully flushed to disk. A return value of –1 indicates an error, and errno is set to EBADF, indicating an invalid file descriptor parameter.


The _commit function forces the operating system to write the file associated with fd to disk. This call ensures that the specified file is flushed immediately, not at the operating system's discretion.


Routine Required header Optional headers Compatibility
_commit <io.h> <errno.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.


All versions of the C run-time libraries.

See Also

_Low-Level I/O Routines | creat | _open | _read | _write | Run-Time Routines and .NET Framework Equivalents