65,210
社区成员
发帖
与我相关
我的任务
分享#include "stdafx.h"
#include "atlstr.h"
#include "iostream"
#include "fstream"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
char str[65535];
CString cstr="";
ifstream file(L"weiboa.txt",ios::in);
file.getline(str,65535);
while (!file.eof())
{
file.getline(str,65535);
cstr=str+cstr ;
cout<<str<<endl;
}
cout<<cstr;
file.close();
return 0;
}
CFile file(path, CFile::modeRead);
int fileLen = (int)file.GetLength();
CStringA strA;
char* pBuf = strA.GetBuffer(fileLen + 1);
file.Read(pBuf, fileLen);
pBuf[fileLen] = '\0';
strA.ReleaseBuffer();
file.Close();
str = strA;