标题: 用EnumSystemCodePages函数枚举系统代码页
作者: Demon
链接: https://demon.tw/programming/enumsystemcodepages.html
版权: 本博客的所有文章,都遵守“署名-非商业性使用-相同方式共享 2.5 中国大陆”协议条款。
Windows系统有各种各样的代码页,怎么知道当前系统安装了哪些代码页呢,答案是EnumSystemCodePages函数。
#include <stdio.h>
#include <windows.h>
/*********************************************************/
/* By Demon */
/* https://demon.tw */
/*********************************************************/
BOOL CALLBACK EnumCodePagesProc(LPTSTR lpCodePageString)
{
CPINFOEX info = {0};
UINT cp = atoi(lpCodePageString);
if (GetCPInfoEx(cp, 0, &info))
printf("%s\n", info.CodePageName);
return TRUE;
}
int main()
{
EnumSystemCodePages(EnumCodePagesProc, CP_INSTALLED);
return 0;
}
参考链接:http://msdn.microsoft.com/en-us/library/windows/desktop/dd317825%28v=vs.85%29.aspx
赞赏
微信赞赏
支付宝赞赏
随机文章:
你这些代码是自己买的书籍写到博客上的?还是看msdn写的功能啊?总之你把好的代码分享给大家,我很欣慰.
代码分享也是一种美德
请问为什么我的回调函数只被调用了一次?