Normally, when we want to know the size of an array we use
sizeof(array) but how are going to know the size of the file pointed by fp i.e. FILE *fp? Please help!
Normally, when we want to know the size of an array we use
sizeof(array) but how are going to know the size of the file pointed by fp i.e. FILE *fp? Please help!
you can use size = ftell(fp);
to do this you must first position the file position indicator at the end of the file, this is done using
fseek(fp, 0L, SEEK_END).
the value returned by ftell is the size of your file as a long int
Dear SPOOK,
Thank you very very much, indeed!! I have sought a lot of books just to find out the solution but to no avail. You are really my saviour!! Thanks again and thank for your anticipation.