Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WriteFile

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function writes data to a file, starting at the position indicated by the file pointer. After the write operation has been completed, the file pointer is adjusted by the number of bytes written.

A RAPI version of this function exists called CeWriteFile (RAPI).


BOOL WriteFile( 
  HANDLE hFile, 
  LPCVOID lpBuffer, 
  DWORD nNumberOfBytesToWrite, 
  LPDWORD lpNumberOfBytesWritten, 
  LPOVERLAPPED lpOverlapped
); 
hFile

[in] Handle to the file to be written to. The file handle must have been created with GENERIC_WRITE access to the file.

lpBuffer

[in] Pointer to the buffer containing the data to write to the file.

nNumberOfBytesToWrite

[in] Number of bytes to write to the file.

A value of zero specifies a null write operation. A null write operation does not write any bytes, but does cause the time stamp to change. This function does not truncate the file. To truncate or extend a file, use the SetEndOfFile function.

lpNumberOfBytesWritten

[out] Pointer to the number of bytes written by this function call. This function sets this value to zero before taking action or checking errors.

lpOverlapped

[in] Unsupported. Set to NULL.

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

If part of the file is locked by another process and the write operation overlaps the locked portion, this function fails.

Accessing the output buffer while a write operation is using the buffer can corrupt the data written from that buffer. Applications must not read from, write to, reallocate, or free the output buffer that a write operation is using until the write operation completes.

Headerwinbase.h
Librarycoredll.lib
Windows Embedded CEWindows CE 1.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

Show:
© 2014 Microsoft. All rights reserved.