c++ 获取文本文件大小

180it 2020-02-06 PM 1758℃ 0条

include

include

using namespace std;

void get_size(ifstream &in)
{

long b,e;
b=in.tellg();
in.seekg(0,ios::end);
e=tellg();
long size=e-b;
cout<<"size="<<size<<endl;

}

int main()
{

ifstream in("file.txt");
get_size(in);
in.close();
return 0;

}

支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

c++ 获取文本文件大小