Use [code] and [/code] to encapsulate code
-
fseek (pFile,9,SEEK_SET);
-
Your error is on this line, SEEK_SET sets the origin of the seek (reposition) to the start of the file so with your code the file pointer will always be positioned 9 bytes from the start and ftell should always return 9.
The other options are SEEK_CUR sets the origin as the current position of the file pointer, and SEEK_END set the origin as the end of the file so to position the file pointer at the end of the file so that ftell will give you the file size you should be using
-
fseek (pFile,0,SEEK_END);
-
Also you are opening the file in "r+" mode, but you never write it, however opening the file in text mode can confuse things as end of line processing will happen. I subbest you use "rb" mode instead which is read only binary.
Cheers
Ben