C++ 类型转换

我这里有比较全的各种字符类之间的转换
AnsiString  ->  char *        AnsiString.c_str();
char *       ->  AnsiString   AnsiString=AnsiString(char);
BSTR        ->  char*        char*  char1=AnsiString(bstr).c_str(); 
wchar_t     ->  ansistring   ansistring(wchar_t)
ansistring  ->  wchart       ansistirng.WideChar(); 
char        ->  WideString   char *s="中华人民共和国";
                          wchar *p=Widetring(s).BSTR();  
WideString  ->  char         wchar_t *p=L"中华人民共和国";   
                          char *s=AnsiString(p).c_str(); 
                           要借助于AnsiString与WideString互换;
char * c    ->  wchar_t * cc AnsiString con = c;
                          cc = con.WideChar( cc , con.WideCharBufSize );
wchar_t * c ->  char * cc    AnsiString con = c;
                          cc = con.c_str(); 
WideString  ->  wchar_t      WideString a = L"abc";
                          wchar_t *b = new wchar_t[4];
                          wcscpy(b, a);  //c运行库unicode字符串拷贝函数
                          AnsiString=AnsiString(b);
Pointer     ->  char;       typedef void*                Pointer;          
                            Pointer pTemp;

你可能感兴趣的:(C++,类型转换)