VC8中是
cstringt.h MFC-only string objects
atlstr.h Non-MFC string objects
VC6是
#include <afx.h > 不过,还依赖其他文件,所以新建一个支持mfc的工程吧
使用win32控制台应用程序也能调通的啊,按Alt+F7,在C/C++的Category中选Code Generation,然后Use run-time library选Multithreaded,然后我直接写的代码:
#include <afx.h >
#include <iostream.h >
#include <time.h >
#include <afxtempl.h >
void main()
{
CString MyString;
CTime t=CTime::GetCurrentTime();
cout < <t.GetYear() < <endl < <t.GetDayOfWeek()
< <endl < <t.GetTime() < <endl < <t.GetGmtTm()- >tm_year < <endl;
MyString=t.Format("%A, %B %d, %Y");
cout < <t.GetLocalTm()- >tm_year < <endl < <MyString;
}
也能运行的。