[out] String read from the device.
LowLevelReadString
Reads raw bytes directly from a device without going through the formatted I/O read buffer and returns the results as a string.
Syntax
Section titled “Syntax”virtual HRESULT LowLevelReadString(CString& pBuf, long cchDesired, long lTimeout = CUR_TIMEOUT) override;
virtual HRESULT LowLevelReadString(BSTR* pBuf, long cchDesired, long lTimeout = CUR_TIMEOUT) override;Parameters
Section titled “Parameters”pBuf
cchDesired
[in] Number of bytes to read from the device.
lTimeout
[in] I/O timeout value in milliseconds.
Return value
Section titled “Return value”Returns S_OK if successful, otherwise a failure HRESULT.
Remarks
Section titled “Remarks”Unlike the buffered I/O functions, such as Queryf, Read, ReadNumber, etc., the LowLevelReadString function reads raw bytes directly from the device, rather than going through the formatted I/O read buffer.
Example
Section titled “Example”The following example demonstrates use of the LowLevelReadString function.
STDMETHODIMP Acme4321::IAcme4321_QueryName(BSTR* pbstrName){ HRESULT hr = S_OK;
// Read up to 50 bytes and return as a BSTR hr = io.LowLevel.LowLevelReadString(pbstrName, 50);
return hr;}