我有遗留代码,我正在逐步移植到 Visual C++ (wchar_t) 中的 Unicode 字符。我遇到了我想转换的这段代码:
char tmp[256];
sprintf(tmp, "stuff");
throw exception(tmp);
我想把它改成这样(这给了我一个异常的编译错误):
wchar_t tmp[256];
swprintf(tmp, "stuff");
throw exception(tmp);
到目前为止,我还没有找到任何文件给我抛出异常的 Unicode 等效项,有人可以帮助我吗?
当然,我可以将我的“tmp”转换回 char 字符串,但这样做似乎很愚蠢。