CeReadFile (RAPI) (Windows CE 5.0)

Send Feedback

This function reads data from a file, starting at the position indicated by the file pointer. After the read operation has been completed, the file pointer is adjusted by the number of bytes actually read.

CeReadFile 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.

BOOLCeReadFile( HANDLEhFile, LPVOIDlpBuffer, DWORDnNumberOfBytesToRead, LPDWORDlpNumberOfBytesRead, LPOVERLAPPEDlpOverlapped);

Parameters

  • hFile
    [in] Handle to the file to be read. The file handle must have been created with GENERIC_READ access to the file. This parameter cannot be a socket handle.
  • lpBuffer
    [out] Pointer to the buffer that receives the data read from the file.
  • nNumberOfBytesToRead
    [in] Number of bytes to be read from the file.
  • lpNumberOfBytesRead
    [out] Pointer to the number of bytes read. CeReadFile sets this value to 0 before doing any work or error checking.
  • lpOverlapped
    [in] Unsupported; set to NULL.

Return Values

The CeReadFile function returns when one of the following is true: the number of bytes requested has been read or an error occurs.

Nonzero indicates success. If the return value is nonzero and the number of bytes read is 0, the file pointer was beyond the current end of the file at the time of the read operation. Zero indicates failure. To get extended error information, call CeGetLastError.

Remarks

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

Accessing the input buffer while a read operation is using the buffer may lead to corruption of the data read into that buffer. Applications must not read from, write to, reallocate, or free the input buffer that a read operation is using until the read operation completes.

The ReadFile function may fail and return ERROR_INVALID_USER_BUFFER or ERROR_NOT_ENOUGH_MEMORY whenever there are too many outstanding asynchronous I/O requests.

When a synchronous read operation reaches the end of a file, ReadFile returns TRUE and sets *lpNumberOfBytesRead to 0. Windows CE does not support asynchronous read operations on files.

Requirements

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

See Also

RAPI Functions | CeCreateFile (RAPI) | CeGetLastError | CeWriteFile (RAPI) | ReadFile

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.