0

This is a two part question: 1) Why does copy.c have to skip over padding? 2) If it already skipped over the padding, why is it adding it back? Wouldn't this make extra padding?

I have been reading a lot of other people's posts regarding resize and copy.c but can't seem to understand this part. Thanks

 // skip over padding, if any
            fseek(inptr, padding, SEEK_CUR);

            // then add it back (to demonstrate how)
            for (int k = 0; k < padding; k++)
            {
                fputc(0x00, outptr);
            }
0

That comment is a leftover from example code earlier in the week's work. I've always thought it was an unfortunate choice of words for the pset.

What you are really doing is skipping over the padding in the input file, while adding the appropriate amount of padding to the output file. The two values are not necessarily the same. In fact, they are independent of each other and both must be calculated.

If this answers your question, please click on the check mark to accept. Let's keep up on forum housekeeping. ;-)

2
  • Ahhhhh I get it. Thank you so much for explaining it so simply. – noggy Nov 13 '15 at 0:30
  • To be perfectly clear, the comments were appropriate for copy.c, and is a good demo for what is to come later. My answer applies to resize. – Cliff B Nov 13 '15 at 3:23

You must log in to answer this question.

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