[in] String describing the format for arguments. See the topic I/O Format Specifiers for Write Operations for details.
Printf
Sends formatted output to a device.
Syntax
Section titled “Syntax”virtual HRESULT Printf(const CString strFormat [, argument] ...) abstract;Parameters
Section titled “Parameters”strFormat
argument
[in] Optional arguments interpreted by the format string.
Return value
Section titled “Return value”Returns S_OK if successful, otherwise a failure HRESULT.
Remarks
Section titled “Remarks”The Printf function formats and sends a series of characters to a device. Any arguments passed to Printf are converted and formatted and the resulting string is sent to the formatted I/O buffer.
If the strFormat parameter ends in a newline character (\n), then the contents of the formatted I/O buffer are flushed to the device and an END indicator is sent with the last byte (the newline character).
If the I/O buffer is flushed, the instrument is polled for errors.
Example
Section titled “Example”The following example demonstrates use of the Printf function. Note that the topic I/O Format Specifiers for Write Operations has many more examples of format strings that can be used with Printf.
STDMETHODIMP Acme4321::IAcme4321_Configure(double Range, double Resolution){ HRESULT hr = S_OK;
// Send command to device, flush I/O buffer hr = io.Printf(_T("SENS:MEAS %f, %6.2e"), Range, Resolution);
return hr;}