0

Does the pointer move one position further after the fread function has read a pixel (for example)?

I will try to be more articulate with this example:

 fread(&triple, sizeof(RGBTRIPLE), 1, inptr);

If this line of code is implemented two times (when it's in a loop for example), will the pointer be one position forward or will it point to the same bytes it pointed to the first time. If the latter is wrong and the pointer points to the bytes next to the ones it pointed during the first implementation, does this happen automatically (it's written in the fread function) or is there a different reason?

1 Answer 1

1

Simply put, the pointer will automatically be moved to point at the first unread byte past whatever was read in that particular statement, whether it was 1 byte or 512 bytes, or anything else. If you had two freads that each read 10 bytes, then the pointer moves 20 bytes and will point at the first byte following the 20 that were read.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

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