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?
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.Sign up to join this community
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.