现在的位置: 首页 > 综合 > 正文

ifstream中取得文件长度

2013年10月14日 ⁄ 综合 ⁄ 共 206字 ⁄ 字号 评论关闭
  ifstream   in("readme.txt");  
  ...  
  streampos   pos   =   in.tellg();     //   save   current   position  
  in.seekg(0,   ios::end);  
  cout   <<   "file   length   ="   <<   in.tellg()   <<   endl;  
  in.seekg(pos);     //   restore   saved   position   
 

抱歉!评论已关闭.