Click or drag to resize

ScanfNoPoll

Reads formatted input from a device without polling for errors.

virtual HRESULT ScanfNoPoll(const CString strFormat [, argument] ...) abstract;
Parameters
strFormat

[in] String describing the format of the data to be read. See the topic I/O Format Specifiers for Read Operations for details.

argument

[in] Optional arguments interpreted by the format string.

Return Value

Returns S_OK if successful, otherwise a failure HRESULT.

Remarks

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

Example

The following example demonstrates use of the ScanfNoPoll function. Note that the topic I/O Format Specifiers for Read Operations has many more examples of format strings that can be used with ScanfNoPoll.

C++
// CoAcme4321.cpp
STDMETHODIMP Acme4321::IAcme4321_Configure()
{
  HRESULT hr = S_OK;

  // Send ID query to device
  hr = io.PrintfNoPoll(_T("*IDN?"));
  if (SUCCEEDED(hr))
  {
    CString strManufacturer, strModel, strSerial, strRevision;

    hr = io.ScanfNoPoll(_T("%$C[^,],%$C[^,],%$C[^,],%$C[^,]"), &strManufacturer, &strModel, &strSerial, &strRevision);           

    // ...
  }

  return hr;
}
See Also

Download a complete CHM version of this documentation here.