title: Returning the size file without read permission c++
body: <p>I am using this piece of code </p>
  
  <pre><code>long filesize (const char * filename)
  {
      ifstream file (filename, ios::in|ios::binary);
      file.seekg (0, ios::end);
      return file.tellg();
  }
  </code></pre>
  
  <p>in order to return the size of file in bytes.
  However i file without read permission results in returning -1.
  Is there any way using c++ or c to return size of the file and directories , that works even on file without read permission?
  I was looking for a while but fail to find solid solution.</p>