#include <iostream>
#include <fstream>
#include <iterator>
#include <list>
#include <errno.h>
#include <string.h>
using namespace std;
int main()
{
ifstream inf("data.dat");
if(inf)
{
istream_iterator<string> it(inf),end;
list<string> ls(it,end);
ostream_iterator<string> ot(cout," ");
copy(ls.begin(),ls.end(),ot);
cout<<endl;
inf.close();
}
else
{
cerr<<strerror(errno)<<endl;
}
return 0;
}
c++ stl 读文件
最新推荐文章于 2024-07-07 12:49:05 发布