[实用程序源码及工具软件] C++取文件长度源码

[复制链接]
 楼主| hotpower 发表于 2023-9-18 23:16 | 显示全部楼层 |阅读模式
  1. int Length(const string& filename)
  2. {
  3.         int filelength = 0;
  4.         ifstream ifs;
  5.         ifs.open(filename.c_str(), ios::in);
  6.         if (ifs.is_open()) {
  7.                 ifs.seekg(0, std::ios::end);
  8.                 filelength = (int)ifs.tellg();
  9.         }
  10.         ifs.close();
  11.         return filelength;
  12. }


您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:[url=http://www.21ic.com/tools/HotWC3_V1.23.html]

1460

主题

21619

帖子

508

粉丝
快速回复 在线客服 返回列表 返回顶部