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;
}
#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;
}
相关文章推荐
- ASCII、Unicode、GBK和UTF-8字符编码的区别联系
- ASCII、Unicode、GBK和UTF-8字符编码的区别联系
- 字符编解码的故事(ASCII,ANSI,Unicode,Utf-8区别)
- ASCII、Unicode、GBK和UTF-8字符编码的区别联系
- ASCII、Unicode、GBK和UTF-8字符编码的区别联系
- 黑马程序员java基础学习日记——做题遇到GBK查资料发现了个有趣的文章——ASCII、Unicode、GBK和UTF-8字符编码的区别联系
- 字符编解码的故事–ASCII,ANSI,Unicode,Utf-8区别(转)
- ASCII、Unicode、GBK和UTF-8字符编码的区别联系
- 字符编解码的故事–ASCII,ANSI,Unicode,Utf-8区别
- 字符编解码的故事(ASCII,GBK,Unicode,Utf-8区别)
- ASCII、GBK、Unicode和UTF-8字符编码的区别联系
- 字符编解码的故事(ASCII,ANSI,Unicode,Utf-8区别)
- ASCII、Unicode、GBK和UTF-8字符编码的区别联系
- ASCII、Unicode、GBK和UTF-8字符编码的区别联系
- 【编码】ASCII、Unicode、GBK和UTF-8字符编码的区别联系
- UNICODE、多字节(MBCS)、双字节(DBCS)、ANSI字符集、ASCII、宽字符 的区别与关联。
- ASCII、Unicode、GBK和UTF-8字符编码的区别联系
- ASCII、Unicode、GBK和UTF-8字符编码的区别联系
- 字符编解码的故事(ASCII,GBK,Unicode,Utf-8区别)
- ASCII、Unicode、GBK和UTF-8字符编码的区别联系