I have a code like this
#include "atlstr.h"
void DisplayMessage(CString pszFormat, ...)
{
CString str;
va_list argList;
va_start(argList, pszFormat);
str.Format(pszFormat, argList);
va_end(argList);
_tprintf(_T("%s"), str);
}
void main()
{
DisplayMessage("This should be right %.2f = 700.0", 700.0);
//Stop to watch
int i = 0;
scanf_s("%d",i);
}
But what I got when I run the code is
This should be right 0.00 = 700.0
I read this article and I got
... Notice that testit expects its second parameter to be either an int or a char*. ...
How can I fix this? The function str.Format can do it right so I know there must be a way - I have read the source code of the Format function but I still don't know how to fix it. Thank for reading :)