Reads data from the specified file or device. Data may be read asynchronously or synchronously.
BOOLEAN ReadRtFile(
RTHANDLE hFile,
LPVOID lpBuffer,
DWORD cbBufferSize,
LPDWORD lpcbBytesRead,
LPASYNCIO lpAsync);
hFile
lpBuffer
cbBufferSize
lpcbBytesRead
lpAsync
A synchronous operation is started by supplying NULL
for the lpAsynch
parameter, and returns after the operation is complete, or an error was detected. If the operation was successful, and a non-null value has been provided for lpcbBytesRead
, then the actual count of bytes read is returned through that pointer.
An asynchronous operation is started by supplying a pointer to an initialized ASYNCIO structure in the lpAsync parameter, and the function returns after the parameters have been verified and the read operation has been started but before the entire operation has completed.
The structure must be initialized with at least a handle for a data mailbox through which the ASYNCIO structure is returned on completion of the operation. To complete the operation, wait on the mailbox for the structure to be returned, or call WaitForRtIo with the file handle and the same async pointer supplied to the ReadRtFile call.
Returns TRUE on success, else FALSE on failure. Status codes returned by GetLastRtError on failure include:
Status value | Meaning |
---|---|
E_EXIST | The handle provided is not a valid handle |
E_TYPE | The handle provided is not a handle for a file |
E_PARAM | The file was opened in asynchronous mode, but the lpAsync parameter is NULL, or the file was opened in synchronous mode and the lpAsync parameter is not NULL. |
E_IO_HARD | An I/O error occurred during the operation |
E_BAD_BUF | The buffer provided is not writable, or the address is invalid |
E_CONN_NOT_OPEN | The handle provided does not refer to an open file |
E_SLOT | No more GDT slots are available. This can occur when a very large number of asynchronous operations are outstanding. |
E_NOT_CONFIGURED | Call is not supported in INtime Distributed RTOS. |
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 6.0 | intime/rt/include/rtbase.h | rt.h | rt.lib |