使用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 永遇乐 阅读(1265) 评论(0)  编辑 收藏 引用 所属分类: STL & Boost


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


<2024年3月>
252627282912
3456789
10111213141516
17181920212223
24252627282930
31123456

导航

统计

常用链接

留言簿(6)

随笔分类

推荐Blog

友情链接

搜索

最新评论

阅读排行榜