How do you determine the length of a file without manually traversing it from the beginning and looking for eof?
How do you determine the length of a file without manually traversing it from the beginning and looking for eof?
file.seekg ( 0, ios::end );
int size = file.tellg();
-Prelude
My best code is written with the delete key.
or if you are using handles, you can use filelength (), and if you need a translation from streams you can do filelength ( fileno (stream));
hasafraggin shizigishin oppashigger...
If you are using Preulde's method you need to besure to open the file in binary mode or else the new line characters and other things can mess up the size.
"only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein