Partager via


_commit

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at _commit.

Flushes a file directly to disk.

Syntax

int _commit(   
   int fd   
);  

Parameters

fd
File descriptor referring to the open file.

Return Value

_commit returns 0 if the file was successfully flushed to disk. A return value of –1 indicates an error.

Remarks

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.

If fd is an invalid file descriptor, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, the function returns -1 and errno is set to EBADF.

Requirements

Routine Required header Optional headers
_commit <io.h> <errno.h>

For more compatibility information, see Compatibility in the Introduction.

See Also

Low-Level I/O
_creat, _wcreat
_open, _wopen
_read
_write