[in] Data read from the device.
ReadAsync
Reads data from a device asynchronously.
Syntax
Section titled “Syntax”virtual HRESULT ReadAsync(BYTE* pBuf, long cbDesired, ULONG* plJobId) abstract;Parameters
Section titled “Parameters”pBuf
cbDesired
[in] Number of bytes to read from the device.
plJobId
[in] Asynchronous job identifier for the operation.
Return value
Section titled “Return value”Returns S_OK if successful, otherwise a failure HRESULT.
Remarks
Section titled “Remarks”The ReadAsync function asynchronously sends data to the device. Unlike the buffered I/O functions, such as Queryf, Read ReadNumber, etc., the ReadAsync function reads raw bytes directly from the device, rather than going through formatted I/O read buffer.
The ReadAsync function returns immediately. An I/O Completion event will be posted when the transfer is actually completed. The plJobId can be used with an I/O Completion event to identify which asynchronous write operation completed.
Example
Section titled “Example”The following example demonstrates use of the ReadAsync function.
STDMETHODIMP Acme4321::IAcme4321_Read(SAFEARRAY** ppsaData){ HRESULT hr = S_OK;
long lJobId; hr = io.LowLevel.ReadAsync(ppsaData, 1000, &lJobId);
return hr;}