Binary Files
#include <iostream>
using namespace std;
#include <fstream>
int main ()
{
long start,end;
ifstream myfile ("test.txt", ios::in|ios::binary);
start = myfile.tellg();
myfile.seekg (0, ios::end);
end = myfile.tellg();
myfile.close();
cout << "size of " << "test.txt";
cout << " is " << (end-start) << " bytes.\n";
return 0;
}
Related examples in the same category