CSDN博客

img owl2008

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

发表于2004/9/27 20:10:00  1338人阅读

#include <windows.h>

#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;

}

阅读全文
0 0

相关文章推荐

img
取 消
img