![]() | ReadString |
Reads string data from a device.
virtual HRESULT ReadString(CString& pResult, long lTimeout = CUR_TIMEOUT) override; virtual HRESULT ReadString(BSTR* pResult, long lTimeout = CUR_TIMEOUT) override;
[out] String data read from the device.
[in] I/O timeout value in milliseconds.
Returns S_OK if successful, otherwise a failure HRESULT.
The ReadString function reads from the formatted I/O read buffer until an END condition or termination character is encountered.
The following example demonstrates use of the ReadString function.
// CoAcme4321.cpp STDMETHODIMP Acme4321::IAcme4321_QueryData(BSTR* pbstrData) { HRESULT hr = S_OK; // Read until END or termchar encountered hr = io.ReadString(pbstrData); return hr; }