© / Posted in 知识如海 / September 6, 2010
// 输出中文
char szA[8];
WCHAR szW[8];
sprintf(szA, "%s", L"和平"); // 乱码,四个字节
sprintf(szA, "%s", "和平"); // 和平
sprintf(szA, "%S", L"和平"); // 零字节
sprintf(szA, "%S", "和平"); // 零字节
swprintf(szW, L"%s", L"和平"); // 和平,四个字节
swprintf(szW, L"%s", "和平"); // 无法输出,四个字节,内容是ANSI码
swprintf(szW, L"%S", L"和平"); // 无法输出,八个字节,内容是Unicode码
swprintf(szW, L"%S", "和平"); // 无法输出,八个字节,内容是ANSI码
wsprintfA(szA, "%s", L"和平"); // 乱码,四个字节
wsprintfA(szA, "%s", "和平"); // 和平
wsprintfA(szA, "%S", L"和平"); // 和平
wsprintfA(szA, "%S", "和平"); // 乱码,两个字节
wsprintfW(szW, L"%s", L"和平"); // 和平,四个字节
wsprintfW(szW, L"%s", "和平"); // 无法输出,四个字节,内容是ANSI码
wsprintfW(szW, L"%S", L"和平"); // 无法输出,六个字节,内容是Unicode码
wsprintfW(szW, L"%S", "和平"); // 和平,八个字节
// 输出英文
char szA[8];
WCHAR szW[8];
sprintf(szA, "%s", L"well"); // w,一个字节
sprintf(szA, "%s", "well"); // well,四个字节
sprintf(szA, "%S", L"well"); // well,四个字节
sprintf(szA, "%S", "well"); // 零字节
swprintf(szW, L"%s", L"well"); // well,八个字节
swprintf(szW, L"%s", "well"); // 乱码,四个字节
swprintf(szW, L"%S", L"well"); // w,两个字节
swprintf(szW, L"%S", "well"); // well,八个字节
wsprintfA(szA, "%s", L"well"); // w,一个字节
wsprintfA(szA, "%s", "well"); // well,四个字节
wsprintfA(szA, "%S", L"well"); // well,四个字节
wsprintfA(szA, "%S", "well"); // 乱码,四个字节
wsprintfW(szW, L"%s", L"well"); // well,八个字节
wsprintfW(szW, L"%s", "well"); // 乱码,四个字节,内容是ANSI码
wsprintfW(szW, L"%S", L"well"); // w,两个字节
wsprintfW(szW, L"%S", "well");
有点像C语言,嘿嘿
没看懂……
输出英文就是正常的了!
网站的风格主题和我的(http://soli.cnblogs.com)很像哦~~~!
呵呵
学习了
学习了|!!!安抚
全是代码 晕了!
这是什么啊,没看懂哦,代码干嘛的啊
很感谢博主的分享,学习了
C语言。好熟悉,我懂哈哈。。。
我懂哈哈。。。
中秋节快到了,祝你中秋节快乐哈。
学习了,,支持下
中秋节快乐哈。
本来就是C语言啊。。语言最简单的部分都雷同的吧
看了这个标题好有亲切感,第一次学c语言就是这几个命令
好深奥啊这个。。要好好学编程了我
博客写得很好,长见识了