![]() | ReadNoPoll |
Reads data from a device without polling for instrument errors after the read.
virtual HRESULT ReadNoPoll(char& ch, bool bFlush = true, long lTimeout = CUR_TIMEOUT) override; virtual HRESULT ReadNoPoll(BYTE* pBuf, long cbDesired, long* pcbActual, bool bFlush = true, long lTimeout = CUR_TIMEOUT) override; virtual HRESULT ReadNoPoll(SAFEARRAY** pBuf, long cbDesired, bool bFlush = true, long lTimeout = CUR_TIMEOUT) override;
[out] Single character read from the device.
[out] Array of bytes read from the device.
[in] Number of elements (bytes) to read from the device.
[out] Actual number of elements (bytes) read from the device.
[in] If true, the formatted I/O read buffer is flushed.
[in] I/O timeout value in milliseconds.
Returns S_OK if successful, otherwise a failure HRESULT.
This function behaves identically to Read except that the device is not polled for errors after the data is read.
The following example demonstrates use of the ReadNoPoll function.
// CoAcme4321.cpp STDMETHODIMP Acme4321::IAcme4321_QueryData(SAFEARRAY** ppsaData) { HRESULT hr = S_OK; // Read 1000 Bytes. Type of elements is automatically determined from the type of the ppsaData SAFEARRAY parameter hr = io.ReadNoPoll(ppsaData, 1000); return hr; }