windows下, 宽字符和窄字符的打印输出

#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>

int main()
{
    setlocale(LC_ALL, "");
    WCHAR szWchar[MAX_PATH] = L"WCHAR中文TEST";
    char szChar[MAX_PATH] = "CHAR汉语测试TEST";
    printf("szWchar = %S, length = %d
", szWchar, wcslen(szWchar));
    printf("szChar = %s, length = %d
", szChar, strlen(szChar));
    wprintf(L"wprintf szWchar = %s
", szWchar);
    wprintf(L"wprintf szChar = %S
", szChar);
    printf("end
");
    system("pause");
    return 0;
}

原文地址:https://www.cnblogs.com/endenvor/p/12407613.html