CStringT::FormatV

Formats a message string using a variable argument list.

void FormatV(
   PCXSTR pszFormat,
   va_list args
);

Parameters

  • pszFormat
    Points to the format-control string. It will be scanned for inserts and formatted accordingly. The format string is similar to run-time function printf-style format strings, except it allows for the parameters to be inserted in an arbitrary order.

  • args
    Pointer to a list of arguments.

Remarks

Writes a formatted string and a variable list of arguments to a CStringT string in the same way that vsprintf_s formats data into a C-style character array.

Example

void WriteString(LPCTSTR pstrFormat, ...)
{
    CString str;

    // format and write the data you were given
    va_list args;
    va_start(args, pstrFormat);

    str.FormatV(pstrFormat, args);
    va_end(args);

    _tprintf_s(str);
    return;
}
// Call the above WriteString function.
WriteString(_T("%d error(s) found in %d line(s)"), 10, 1351);

Requirements

Header: cstringt.h

See Also

Reference

CStringT Class

Other Resources

CStringT Members