Is it possible to retrieve file stats, like size (in bytes)? If so, how?
I'm reading in a text file and I want to display the % that has been read so far.
File Properties
Started by bladactania, Apr 01 2008 01:35 PM
4 replies to this topic
#1
Posted 01 April 2008 - 01:35 PM
|
|
|
#2
Posted 02 April 2008 - 07:54 AM
It will depend on the OS you are working in.
#3
Posted 02 April 2008 - 09:07 AM
Linux
#4
Posted 26 April 2008 - 09:16 PM
the following is the platform independent way of getting the file size
FILE*fp = fopen("hackme.dat","r");
int size;
size = fseek(fp,0,SEEK_END);
fseek returns the current byte position in the file..........
using this fact i am moving zero bytes ahead from end of file ;) which returns the byte position of end of file => file size..........
give a try.....
FILE*fp = fopen("hackme.dat","r");
int size;
size = fseek(fp,0,SEEK_END);
fseek returns the current byte position in the file..........
using this fact i am moving zero bytes ahead from end of file ;) which returns the byte position of end of file => file size..........
give a try.....


Sign In
Create Account


Back to top









