linyawen

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1, infile >> str 碰到回车空格就不继续了。

 

2,IOStream著名专家Dietmar Kuehl给过两个方法 

   std::ifstream in("some.file"); 
   std::istreambuf_iterator<char> beg(in), end; 
   std::string str(beg, end); 

或 

   std::ifstream in("some.file"); 
   std::ostringstream tmp; 
   tmp << in.rdbuf(); 
   std::string str = tmp.str();

posted on 2011-12-22 15:29  linyawen  阅读(6541)  评论(0编辑  收藏  举报