标签:style blog color os io ar div sp log
#include<iostream> #include<fstream> #include<cstring> using namespace std; int main() { ifstream file("1.txt"); char ch[20]; cout<<"getline: "<<endl; while(file.getline(ch,1000000,‘\n‘)) cout<<ch<<endl; //get调用之后只会显示一行,因为get不会丢弃流中的换行符 cout<<"get:"<<endl; while(file.get(ch,1000000,‘\n‘)) cout<<ch<<endl; }
标签:style blog color os io ar div sp log
原文地址:http://www.cnblogs.com/wuchanming/p/3954248.html