What is the best way to determine the size of a file? I've opened it for read access using fopen(), and would like to know the size of the file before I proceed further. I checked MSDN and found a list of stream i/o functions, but didn't see anything for this. I suppose that I could do something like this
But that isn't working. I also tried
cout<<"Reading data from input file..."<<endl;
while(fread(temp, 1, 1, input))
But for some reason, that always gave me 0, even though fread(), according to MSDN, "returns the number of full items actually read, which may be less than countif an error occurs or if the end of the file is encountered before reaching count.
len=fread(temp, 1, 100000000, input);
So, how do you determine the size of a file in bytes? Thanks.