// 使用wprintf输出中文时,需调用setlocale(LC_CTYPE, ""); 将输出字符集设置为本地字符集
setlocale(LC_CTYPE, ""); // 设为本地字符集
……
setlocale(LC_CTYPE, "C"); // 恢复默认值
PS:
下列函数不需要调用setlocale:
wsprintfW() // include <Windows.h>
swprintf() // include <stdio.h>
MultiByteToWideChar // include <Windows.h>