C++文件操作
基本文件操作
题目要求:
#include<iostream>
#include<string>
#include<iomanip>
#include<fstream>
using namespace std;
int main() {
ifstream in("信息文本");
if (in) {//判断文件是否成功打开
char s[500];
while (!in.eof())
{
in.getline(s, sizeof(s));
cout << s << endl;
}
cout << "This is a file." << endl;
cout << "Please double it.";
in.close();
}
system("pause");
return 0;
}