Warning: file_get_contents() [function.file-get-contents]: SSL: 远程主机强迫关闭了一个现有的连接。 in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884

Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
控制台输出wchar_t数组遇到中文不显示或者乱码解决方案 - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


C语言控制台输出wchar_t数组遇到中文时不显示或者乱码解决方案


需要设置本地语言。如下:

setlocale(LC_ALL, "chs");
// 或者
setlocale(LC_ALL, "zh_CN.utf8");

setlocale函数需要以下头文件:

#include <locale.h>


再使用printf输出:

wchar_t ws[] = L"国家"; 
printf("printf content start: %ls\n", ws);

这样就是没问题的。



返回首页


Copyright (C) 2018-2024 huidong