-2

I need a plain English explanation of how the while loop operates for the fread statement.

After reading in the first 512 bytes, how does it loop to the next 512 bytes till it gets to the last block?

  • 1
    If you'll edit your post to show the while loop, maybe we can answer. ;-) – Cliff B Jun 11 at 6:05
0

Would be nice to see some actual code so we have something to work with but I am assuming your question is how this while(fread(bytes, 1, 512, file) == 512) iterates through the file. As I understand it, it just reads the next block of bytes everytime it repeats, nothing fancy. In this case it would repeat until it does not read an entire block of 512 bytes. https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fread?view=vs-2019 for further information.

| improve this answer | |

You must log in to answer this question.

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