While it is not the end of a file, output file line by line

来源:互联网 发布:淘宝情趣用品店名大全 编辑:程序博客网 时间:2024/05/18 20:11
#include <iostream>#include <fstream>using namespace std;int main () { char buffer[256]; ifstream myfile ("test.txt"); while (! myfile.eof() ) {   myfile.getline (buffer,100);   cout << buffer << endl; } return 0;}

原创粉丝点击