Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. ============================
  2. #include <sys/stat.h>
  3. ...
  4. struct stat results;
  5. if (stat("input.bin", &results) == 0)
  6. // The size of the file in bytes is in
  7. // results.st_size
  8. else
  9. // An error occurred
  10. ============================
  11.  
  12. fsize = myfile.tellg();
  13. // The file pointer is currently at the beginning
  14. myfile.seekg(0, ios::end);
  15. // Place the file pointer at the end of file
  16. fsize = myfile.tellg() - fsize;
  17. myfile.close();
  18. cout << "size is: " << fsize << " bytes.\n";
  19.  
  20. =============================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement