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;
}