Guest User

Untitled

a guest
Aug 4th, 2020
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1.     int sizeFile(const string path)
  2.     {
  3.         fstream fs;
  4.         fs.open(path, fstream::in | fstream::out | fstream::app);
  5.         if (!fs.is_open())
  6.         {
  7.             throw file_not_found("Error! File not found!");
  8.         }
  9.         else
  10.         {
  11.             fs.seekg(ios::end);
  12.             int length = fs.tellg();
  13.             return length;
  14.         }
  15.         fs.close();
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment