Skip to content

LowLevelReadStringNoPoll

Reads raw bytes directly from a device without going through the formatted I/O read buffer and returns the results as a string.

virtual HRESULT LowLevelReadString(CString& pBuf, long cchDesired, long lTimeout = CUR_TIMEOUT) override;
virtual HRESULT LowLevelReadString(BSTR* pBuf, long cchDesired, long lTimeout = CUR_TIMEOUT) override;

pBuf

[out] String read from the device.

cchDesired

[in] Number of bytes to read from the device.

lTimeout

[in] I/O timeout value in milliseconds.

Returns S_OK if successful, otherwise a failure HRESULT.

This function behaves identically to the LowLevelReadString function except that the device is not polled for errors after the data is read.

The following example demonstrates use of the LowLevelReadStringNoPoll function.

CoAcme4321.cpp
STDMETHODIMP Acme4321::IAcme4321_QueryName(BSTR* pbstrName)
{
HRESULT hr = S_OK;
// Read up to 50 bytes and return as a BSTR
hr = io.LowLevel.LowLevelReadStringNoPoll(pbstrName, 50);
return hr;
}