0
点赞
收藏
分享

微信扫一扫

C语言开发环境Code:Blocks的安装及中文乱码解决


下载链接  http://www.codeblocks.org/downloads/26

我选择:codeblocks-16.01mingw-nosetup.zip  表示带mingw(gcc编译环境),绿色非安装版本,压缩包88M,解压后228M

解压后,双击CbLauncher.exe运行,

windows下解决乱码问题,请按照如下图所示配置:

C语言开发环境Code:Blocks的安装及中文乱码解决_乱码问题

C语言开发环境Code:Blocks的安装及中文乱码解决_#include_02

-finput-charset=WINDOWS-936
-fexec-charset=WINDOWS-936

测试C语言代码:

#include<stdio.h>
#include<stdlib.h>
#include<wchar.h>
#include<string.h>
#include<locale.h>
int main(void)
{

 char str[]="中国china";
 wchar_t str_w[]=L"中国china";

 int len=(int)strlen(str);
 int len_w=(int)wcslen(str_w);
 printf("%s,size=%d/n",str,len);

 setlocale(LC_ALL, "chs");
 wprintf(L"%s,size=%d/n",str_w,len_w);

 system("pause");
 return 0;
}

举报

相关推荐

0 条评论