Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ============================
- #include <sys/stat.h>
- ...
- struct stat results;
- if (stat("input.bin", &results) == 0)
- // The size of the file in bytes is in
- // results.st_size
- else
- // An error occurred
- ============================
- fsize = myfile.tellg();
- // The file pointer is currently at the beginning
- myfile.seekg(0, ios::end);
- // Place the file pointer at the end of file
- fsize = myfile.tellg() - fsize;
- myfile.close();
- cout << "size is: " << fsize << " bytes.\n";
- =============================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement