How can we calculate text file size in bytes? Using VC++!
Printable View
How can we calculate text file size in bytes? Using VC++!
Code:int GetFileSize(const std::string& FileName)
{
int Size;
std::ifstream File;
File.open(FileName.c_str(), std::ios::in | std::ios::binary);
if(File.fail()) return -1;
File.seekg(0, std::ios::end);
Size = File.tellg();
File.close();
return Size;
}