首页 > 编程语言 > 详细

C++ txt文档读取

时间:2016-07-14 11:45:27      阅读:230      评论:0      收藏:0      [点我收藏+]

void readfile(string filepath){
ifstream myfile;

if (!myfile) {
cout << "打开文件出错!";
exit(1);

}else{
myfile.open(filepath);
string ss;
while(getline(myfile,ss))//着行读取数据并存于s中,直至数据全部读取
{
cout<<ss<<endl;
}
system("pause");
myfile.close();
}
}

C++ txt文档读取

原文:http://www.cnblogs.com/anna-sz/p/5669871.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!