Click or drag to resize

VQueryf

Performs a formatted write and read through a single operation invocation.

virtual HRESULT VQueryf(const CString strWriteFormat, const CString strReadFormat, va_list& argList, long lTimeout = CUR_TIMEOUT) abstract;	
Parameters
strFormat

[in] String describing the format for arguments. See the topic I/O Format Specifiers for Write Operations for details.

argList

[in] Argument list interpreted by the format string.

lTimeout

[in] I/O timeout in milliseconds.

Return Value

Returns S_OK if successful, otherwise a failure HRESULT.

Remarks

This function behaves identically to Queryf except that the arguments are 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. This is Indeed, the implementation of Queryf in NtlIo.inl is done in terms of VQueryf, 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 VQueryf function call. The timeout is returned to its previous value after VQueryf returns. If lTimeout is not specified, then the I/O timeout is not modified.

Example

The following example demonstrates use of the VScanf function.

C++
// NtlIo.h
inline HRESULT CIoSession::Queryf(const CString strWriteFormat, const CString strReadFormat, ...)
{
    HRESULT hr = S_OK;

    va_list argList;
    va_start(argList, strReadFormat);

    hr = VQueryf(strWriteFormat, strReadFormat, argList);

    va_end(argList);

    if (SUCCEEDED(hr))
    {
        hr = PollInstrumentErrors();
    }

    return hr;
}
See Also

Download a complete CHM version of this documentation here.