第25周-windows程序设计(基础篇)-第1章-wchar_t 宽字符串

来源:互联网 发布:电脑随机抽取软件 编辑:程序博客网 时间:2024/05/30 22:43

1、宽字符串wchar_t

/*WCHAR.H定义了C中的宽字符基于wchar_t数据形态*/typedef unsigned short wchar_t; //16位宽/*定义宽字符串的指针*/wchar_t *p=L"Hello!"; // L代表long,表示字符串按宽字符保存。指针p占4个字节,字符串14个字节static wchar_t a[]=L"Hello!"; //sizeof(a)返回14.wchar_t c=L'A';char *pc = "Hello!";iLength = strlen(pc);wchar_t *pw = L"Hello!";iLength = strlen(pw); // 应该改为wcslen(pw) 宽字符串长度/*strlen函数的声明*/size_t__cdecl strlen(const char*);/*wcslen函数的声明*/size_t__cdecl wcslen(const wchar_t*);

0 0