为什么有时候会出现乱码?
函数功能:API函数SetConsoleOutputCP用于设置控制台程序输出代码页。
代码页是字符集编码的别名,也有人称"内码表"。早期,代码页是IBM称呼电脑BIOS本身支持的字符集编码的名称。
使用:
#include <windows.h>
#include <stdio.h>
int main( void )
{
SetConsoleOutputCP(936);
printf("简体中文\n");
return 0;
}
还要有头文件#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
这都是不可或缺的