5,530
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main(int argc, char* args[])
{
string file="123.txt";
std::fstream input(file);
if (!input.is_open())
{
std::cout << "Error opening file"; exit(1);
}
while (!input.eof())
{
char buffer[256] = { 0 };
input.getline(buffer,255);
std::cout << buffer << std::endl;
}
input.close();
system("pause");
return 0;
}