数据类型转换

来源:互联网 发布:教跆拳道的软件 编辑:程序博客网 时间:2024/05/17 22:25

1.CString转换到TCHAR*方法 (转自http://cctry.com/viewthread.php?tid=145&page=1)

CString str = "test";
TCHAR *sz=new TCHAR[10];

sz = (LPTSTR)(LPCTSTR)str;

 

2.CString转string:

CString cstr;

string str(cstr.GetBuffer(0));

 

3.char 转WCHAR:

char ch;

WCHAR wch;

通过MultiByteToWideChar函数转换。