My code works correctly when n is 1, but it also doesn't resize anything else. Is it an issue with the way I am declaring
newbf? Thank you in advance!
My code is:
// edited out per academic honesty
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
So close to being finished!
The image is being processed correctly, but the header is wrong when resizing. If you look carefully, the headers of the output file exactly match the input file's headers - hint, hint.
As a side note, while it is correct to use fseek to reposition the file pointer to re-read the headers in order to populate the newbi and newbf headers, it would be more efficient to just copy the originals. A structure can be completely copied with a simple assignment,
newbi = bi;. This will copy every structure element, creating a full copy of the struct.
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)