下面是一些例子(请注意大写S 和小写s 的使用):
C/C++ code
char szA[100]; //An ANSI string buffer
WCHAR szW[100]; //A Unicode string buffer
//Normal sprintf:all strings are ANSI
sprintf(szA, "%s","ANSI Str");
//Converts Unicode string to ANSI
sprintf(szA,"%S",L"Unicode Str");
//Normal swprintf:all strings are Unicode
swprintf(szW,L"%s",L"Unicode Str");
//Converts ANSI string to Unicode
swprintf(szW,L"%S", "ANSI Str");
本文来自优快云博客,转载请标明出处:http://blog.youkuaiyun.com/hejianhua/archive/2009/12/22/5053564.aspx
4574

被折叠的 条评论
为什么被折叠?



