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

时间:2023-03-09 19:34:32
在Windows控制台应用程序中使用CString

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

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

 include "stdafx.h"
#include <atlstr.h>
#include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[])
{
//控制台应用程序中使用CString 包含 atlstr.h头文件即可
CString str(_T("CString TEST!"));
wcout << str.GetBuffer() << endl;
return ; }