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");
posted @ 2011-10-26 14:15  韩冬冬  阅读(267)  评论(0编辑  收藏  举报