You can open the file using the ios::ate flag (and ios::binary flag), so the tellg() function will give you directly the file size:
ios::ate
ios::binary
tellg()
ifstream file( "example.txt", ios::binary | ios::ate); return file.tellg();
1.4m articles
1.4m replys
5 comments
57.0k users