I am using this piece of code
long filesize (const char * filename)
{
ifstream file (filename, ios::in|ios::binary);
file.seekg (0, ios::end);
return file.tellg();
}
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.