在Windows控制台应用程序中使用CString

时间:2014-11-05 00:14:45   收藏:0   阅读:274

CString是在windows平台下开发中经常使用的字符串类,

CString已从MFC中剥离出来了,可以单独使用,只需引用atlstr.h头文件即可。

 1 include "stdafx.h"
 2 #include <atlstr.h>
 3 #include <iostream>
 4 
 5 using namespace std;
 6 
 7 int _tmain(int argc, _TCHAR* argv[])
 8 {
 9     //控制台应用程序中使用CString 包含 atlstr.h头文件即可
10     CString str(_T("CString TEST!"));
11     wcout << str.GetBuffer() << endl;
12     return 0;
13 
14 }

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!