CeWriteFile (RAPI) (Windows CE 5.0)

Send Feedback

This function writes data to a file. CeWriteFile starts writing data to the file 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 actually written.

CeWriteFile is a remote application programming interface (RAPI), which enables an application running on a desktop computer to make function calls on a Windows CE–based device.

BOOLCeWriteFile( HANDLEhFile, LPCVOIDlpBuffer, DWORDnNumberOfBytesToWrite, LPDWORDlpNumberOfBytesWritten, LPOVERLAPPEDlpOverlapped);

Parameters

  • 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 be written to the file.

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

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

  • lpNumberOfBytesWritten
    [out] Pointer to the number of bytes written by this function call. CeWriteFile sets this value to 0 before doing any work or error checking.

  • lpOverlapped
    [in] Unsupported; set to NULL.

Return Values

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

Remarks

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 may lead to corruption of 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.

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Rapi.h.
Link Library: Rapi.lib.

See Also

RAPI Functions | WriteFile | CeCreateFile | CeGetLastError | CeReadFile | CeSetEndOfFile

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.