0

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 newbi and newbf? Thank you in advance! My code is:

// edited out per academic honesty
0
1

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. ;-)

3
  • I'm confused as to where the header problem is. Is it in the for-loop or when I first declare the header? Thank you so much, by the way! – SuperNovaCoder Oct 2 '16 at 21:46
  • Neither. WHICH headers are you writing to the output file? – Cliff B Oct 2 '16 at 21:49
  • Oh! Is it the bf and bi when I fwrite it above? – SuperNovaCoder Oct 2 '16 at 21:52

You must log in to answer this question.

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