使用std::streambuf_iterator读取文件

#include <fstream>
#include <string>

using namespace std;

void main()
{
 ifstream inputFile("Data.txt");
 if(!inputFile.is_open())
           return;
//这条语句在VC6下编译报错,VC6对模板支持不够
 string str((istreambuf_iterator<char>(inputFile)), istreambuf_iterator<char>());
 inputFile.close();
}

posted on 2006-11-04 16:54 永遇乐 阅读(1268) 评论(0)  编辑 收藏 引用 所属分类: STL & Boost


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2006年11月>
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

导航

统计

常用链接

留言簿(6)

随笔分类

推荐Blog

友情链接

搜索

最新评论

阅读排行榜