1

I think I'm having trouble pointing to the correct places using fseek although I can't tell for certain since I don't know where outptr points to.

3

The ftell() function will tell you the current position of the file pointer. For binary files, like in this case, it will return the number of bytes from the beginning of the file. So, for example, in a bitmap file, if ftell() returns 54, then you know you are at the end of the headers and about to read the first pixel.

You can use it like this:

 printf("pointer is at byte: %ld\n", ftell(inptr));

If you want to know where the outptr is pointing to, just use that in a similar way:

printf("outptr is here: %ld\n", ftell(outptr));

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .