Re: VC++ Tips & Tricks The following example demonstrates the use of CStringT::FormatV.
Its very simple to write a program for formatting the variables in Visual C++. Below is a sample #include <string.h>
#include <atlsimpstr.h>
#include <atlstr.h>
void WriteString(LPCSTR 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);
printf(str);
return;
}
int main( )
{
WriteString("%d error(s) found in %d line(s)", 10, 1351);
}
thanks 
__________________ Karpagarajan. R Necessity is the mother of invention
Last edited by Booom : 08-09-2007 at 05:38 AM.
|