#include <iostream.h> #include <fstream.h> const char * filename = "test.txt"; int main () { long l,m; ifstream file (filename, ios::in|ios::binary); l = file.tellg(); file.seekg (0, ios::end); m = file.tellg(); file.close(); cout << "size of " << filename; cout << " is " << (m-l) << " bytes.\n"; return 0; }
size of test.txt is 40 bytes.