您的位置:首页 > 其它

unicode和ASCII两种字符环境的区别

2004-09-27 20:10 375 查看
#include <windows.h><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

#include <tchar.h>

#include <sstream>

using namespace std;

 

#ifdef UNICODE

typedef wstring Astring;

typedef wostringstream OStringstream;

#else

typedef string Astring;

typedef ostringstream OStringstream;

#endif

 

 

int WINAPI _tWinMain( HINSTANCE hInstance,

                      HINSTANCE hPrevInstance,

                      PTSTR     lpCmdLine,

                      int       nCmdShow)

{

    PTSTR str = TEXT("你好");

    PTSTR message = TEXT("hello");

    int a = lstrlen(str);

    OStringstream out_str;

    out_str << "this is " << a << endl;

    Astring s = out_str.str();

    PCTSTR p = s.c_str();

    MessageBox( NULL, p, str, MB_OK );

    return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  winapi include string null