标签:class data c++ ++ return lang seek pos turn
1/
#include <fstream> std::ifstream::pos_type filesize(const char* filename) { std::ifstream in(filename, std::ifstream::ate | std::ifstream::binary); return in.tellg(); }
2/#include <fstream>
int getFileSize(const std::string &fileName)
{
ifstream file(fileName.c_str(), ifstream::in | ifstream::binary);
if(!file.is_open())
{
return -1;
}
file.seekg(0, ios::end);
int fileSize = file.tellg();
file.close();
return fileSize;
}
标签:class data c++ ++ return lang seek pos turn
原文地址:https://www.cnblogs.com/jieliujas/p/12220731.html