阅读背景:

printf(“%s”)、printf(“%ls”)、wprintf(“%s”)和wprintf(“%ls”)之间的区别是什么?

来源:互联网 

Consider this sample program:

考虑一下这个示例程序:

#include <cstdio>
#include <cwchar>
#include <string>

int main()
{
    std::string narrowstr = "narrow";
    std::wstring widestr = L"wide";
    printf("1 %s \n", narrowstr.c_str());
    printf("2 %ls \n", widestr.c_str());
    wprintf(L"3 %s \n", narrowstr.c_str());
    wprintf(L"4 %ls \n", widestr.c_str());

   return 0;
}
#



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: