现在的位置: 首页 > 综合 > 正文

C99中的wchar_t

2013年11月18日 ⁄ 综合 ⁄ 共 757字 ⁄ 字号 评论关闭
/**
 * 1. wchar_t定义在stddef.h中
 * 2. 处理wchar_t类型字符或字符串的函数在wchar.h中
 * 
 * Platform and Compiler
 * Ubuntu, gcc
 * Note: Windows下CodeBlocks(gcc)也不能通过
 */
#include <locale.h>
#include <wchar.h>	// wchar_t类型的字符或字符串处理函数
#include <stddef.h>	// wchar_t
int main(void)
{
        setlocale(LC_ALL, "en_US.UTF-8");	// Shell下输入locale命令查看
        wchar_t wstr[] = L"输出中文真TMD难啊!!!";
        wprintf(L"%ls\n",wstr);
        return 0;
}
/*
【参考文章】

http://blog.csdn.net/lovekatherine/article/details/1868724


http://www.thoughts-of.me/blog.php?id=197&c=0&fp=10&ft=2


http://www.cnblogs.com/niuniu502/archive/2009/02/17/1392636.html

Wide characters, http://uw714doc.sco.com/en/SDK_sysprog/_Wide_Characters.html
Introduction to Extended Characters, http://www.gnu.org/software/libc/manual/html_node/Extended-Char-Intro.html#Extended-Char-Intro
关于wchar_t类型字符或字符串处理函数可参考C99标准
*/

【上篇】
【下篇】

抱歉!评论已关闭.