读书人

sprintf跟swprintf

发布时间: 2013-10-19 20:58:22 作者: rapoo

sprintf和swprintf

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");

读书人网 >编程

热点推荐