![]() | PrintfNoPoll |
Sends formatted output to a device without polling for errors.
virtual HRESULT PrintfNoPoll(const CString strFormat [, argument] ...) abstract;
[in] String describing the format for arguments. See the topic I/O Format Specifiers for Write Operations for details.
[in] Optional arguments interpreted by the format string.
Returns S_OK if successful, otherwise a failure HRESULT.
This function behaves identically to Printf except that the device is not polled for errors after the data is sent. This can be useful in cases where a query string is sent to the device and a separate function will be executed to read the results. Were Printf used in such a situation instead of PrintfNoPoll, the error polling command would attempt to write to the device again -- before the results of the initial query could be read.
The following example demonstrates use of the PrintfNoPoll function. Note that the topic I/O Format Specifiers for Write Operations has many more examples of format strings that can be used with PrintfNoPoll.
// CoAcme4321.cpp STDMETHODIMP Acme4321::IAcme4321_Configure(long Channel, long* Count) { HRESULT hr = S_OK; // Send query command to device, without polling for errors hr = io.PrintfNoPoll(_T("TRIG:COUNT? %d"), Channel); if (SUCCEEDED(hr)) { // ... other logic hr = io.ReadNumber(Count); } return hr; }