I'm using tellg()
to get the size of some files, and it's very important for this project get the real/correct size of files. Now I'm bit worried because a read that tellg() doesn't work perfectly but it can get the wrong size, maybe bigger than the real size. For example here: tellg() function give wrong size of file?
How can I get the correct size?? or isn't it true that tellg
does'nt work very well?
This is my code with tellg()
:
streampos begin,end;
ifstream file_if(cpd_file, ios::binary);
begin = file_if.tellg();
file_if.seekg(0, ios::end);
end = file_if.tellg();
file_if.close();
size = end - begin;