#include<iostream>
#include<Windows.h>
#include<fstream>
#include<string>
using namespace std;
long long getSize(const char*fileName)
{
ifstream infile;
infile.open(fileName);
if (!infile.is_open())
{
cout << "打开失败!" << endl;
return 0;
}
infile.seekg(0, infile.end);
long long ret = infile.tellg();
infile.close();
return ret;
}
int main()
{
cout << getSize("定位.txt") << endl;
system("pause");
return 0;
}
C++ tellg 返回文件的大小
最新推荐文章于 2024-05-19 16:41:19 发布