工作后比较忙,没大块的时间来酝酿博客的写作,所以随时记点笔记,一来方便自己查阅,二来也督促自己学习和总结。如果能对大家有所帮助,就更加开心了
。

在C/C++中输出宽字符可以使用printf + %ls 或者 wcout,详细请看代码:
// 【MoreWindows工作笔记1】 C/C++ 输出宽字符 printf + %ls or wcout
#include <Windows.h>
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
printf(" 【MoreWindows工作笔记1】 C/C++ 输出宽字符 printf + %ls or wcout\n");
printf(" - http://blog.csdn.net/morewindows/article/details/16358175 -\n");
printf(" -- By MoreWindows( http://blog.csdn.net/MoreWindows ) --\n\n");
char text[] = "MoreWindows";
WCHAR w_text[] = L"http://blog.csdn.net/MoreWindows";
printf("%s %ls\n", text, w_text);
cout<<text<<" ";
wcout<<w_text<<endl;
return 0;
}
运行结果如下:
另外,wprintf + %s也可以输出宽字符。
地址:http://blog.csdn.net/morewindows/article/details/16358175 转载请标明出处,谢谢。
欢迎关注微博:http://weibo.com/MoreWindows