[in] String describing the format for arguments. See the topic I/O Format Specifiers for Write Operations for details.
VPrintf
Sends formatted output to a device.
Syntax
Section titled “Syntax”virtual HRESULT VPrintf(const CString strFormat, va_list& argList, long lTimeout = CUR_TIMEOUT) abstract;Parameters
Section titled “Parameters”strFormat
argList
[in] Argument list interpreted by the format string.
lTimeout
[in] I/O timeout in milliseconds.
Return value
Section titled “Return value”Returns S_OK if successful, otherwise a failure HRESULT.
Remarks
Section titled “Remarks”This function behaves identically to Printf except that the argument list is supplied using a va_list argument list instead of separate argument parameters. This type of argument list function is typically used to implement higher-level functions that accept variable argument lists. Indeed, the implementation of Printf in NtlIo.inl is done in terms of VPrintf, as shown in the example later.
The lTimeout parameter allows the I/O timeout to be temporarily changed to the specified value for the duration of the VPrintf function call. The timeout is returned to its previous value after VPrintf returns. If lTimeout is not specified, then the I/O timeout is not modified.
Example
Section titled “Example”The following example demonstrates use of the VPrintf function.
inline HRESULT CIoSession::Printf(const CString strFormat, ...){ HRESULT hr = S_OK;
va_list argList; va_start(argList, strFormat);
hr = CFormattedIo::VPrintf(m_spBuf, m_pEnumFormatter, strFormat, argList);
va_end(argList);
if (SUCCEEDED(hr)) { hr = PollInstrumentErrors(); }
return hr;}