#include <iostream>
#include <
string>
void myformat(
const char *fmt,
)
{
va_list ap;
va_start(ap, fmt);
wchar_t buf[2048];
vswprintf(buf,fmt,ap);
va_end(ap);
std::wcout.imbue(std::locale("chs"));
std::wcout<<buf<<std::endl;
}
如果要返回值:
#include <iostream>
#include <
string>
std::wstring myformat(
const char *fmt,
)
{
va_list ap;
va_start(ap, fmt);
wchar_t buf[2048];
vswprintf(buf,fmt,ap);
va_end(ap);
std::wstring str = std::wstring(buf);
return str;
}