Click or drag to resize

ScanfWithTimeoutNoPoll

Reads formatted input from a device.

virtual HRESULT ScanfWithTimeoutNoPoll(const CString strFormat, long lTimeout, [, 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.

lTimeout

[in] I/O timeout value in milliseconds.

argument

[in] Optional arguments interpreted by the format string.

Return Value

Returns S_OK if successful, otherwise a failure HRESULT.

Remarks

The ScanfWithTimeoutNoPoll function behaves identically to the ScanfWithTimout function except that the device is not polled for errors after the data is read.

Example

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

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

  // Start a measurement that will generate a lot of data
  hr = io.PrintfNoPoll(_T("MEAS:DATA?"));
  if (SUCCEEDED(hr))
  {
    // Read an IEEE 488.2 binary block, needs up to 10 seconds to complete
    SAFEARRAY* psaData = NULL;
    hr = io.ScanfWithTimeoutNoPoll(_T("%$Sb"), 10000, &psaData);

    // I/O timeout automatically changed back to previous value before ScanfWithTimeout call
  }

  return hr;
}
See Also

Download a complete CHM version of this documentation here.