Among the recommended reading list for this pset was this page (http://www.cprogramming.com/tutorial/cfileio.html), which indicates that when using fopen specifically for reading or writing in binary, you should add the character 'b' to the mode argument of fopen. So that would be FILE* inptr = fopen(infile, "rb"). But in copy.c, they just use fopen normally, without the binary flag. Is that wrong, or is the binary flag optional, or are we not actually using binary in this pset?
Also, I'm a little confused about fread. When you specify 'size', for example when reading a pixel from the infile, you could say something like 'sizeof(RGBTRIPLE)'. That tells fread to read 3 bytes (in this case) from our infile. Then the first argument of fread is the variable you want to read TO, so in copy.c that's a variable called triple of type RGBTRIPLE. How does it know which variables in the RGBTRIPLE struct to store which bytes? I'm guessing that it's just reading 3 bytes and storing 1 byte in each of the variables in the struct, but doesn't that seem strange that C has no idea if you're writing too far into an array (for example), but has no problem scanning the different variables in a struct and storing only as many bytes in each variable as that variable can hold? What would happen if we tried to write 4 bytes to a variable of type RGBTRIPLE?
Sorry for the lengthy question, but hopefully someone can shed some light on this.