This documentation is archived and is not being maintained.

CStringT::AppendFormat

Appends formatted data to an existing CStringT object.

void __cdecl AppendFormat(
   PCXSTR pszFormat,
   [, argument]...
);
void __cdecl AppendFormat(
   UINT nFormatID,
   [, argument]...
);

Parameters

pszFormat
A format-control string.
nFormatID
The string resource identifier that contains the format-control string.
argument
Optional arguments.

Remarks

This function formats and appends a series of characters and values in the CStringT. Each optional argument (if any) is converted and appended according to the corresponding format specification in pszFormat or from the string resource identified by nFormatID.

Example

The following example demonstrates the use of CStringT::AppendFormat.

//typedef CStringT< TCHAR, StrTraitATL< TCHAR > > CAtlString;

CAtlString str = "Some data:\t";

str.AppendFormat(_T("X value = %.2f\n"), 12345.12345);
_tprintf("%s", (LPCTSTR) str);

Output

The above code fragment produces this output:

Some data:        X value = 12345.12

See Also

CStringT Overview | Class Members

Show: