Questions tagged [copy.c]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
2answers
208 views

pset4 how does incrementing j help to iterate over pixels?

I'm currently working my way through understanding the code of copy.c used in "whodunit" and "resize". This loop is supposed to iterate over the scanlines of a Bitmap (by incrementing i) and within ...
0
votes
1answer
83 views

pset4 whodunit can't understand the infile pointer

In this whodunit copy.c the input filenames and output filenames are entered as command line arguments but I couldn't understand that How does inputting the file name will point to the file. // ...
0
votes
1answer
103 views

Pset 4- Copy.c- Padding question

I was looking through copy.c, and if the bf.Size part of BITMAPFILEHEADER includes padding, then how come the amount of padding needed isn't even defined in copy.c until after BITMAPFILEHEADER is ...
0
votes
1answer
125 views

What is wrong with my code? - Resize Pset4

I'm Samuel and I have been working on Problem Set 4 and I have been working a long time on resize. I have refined it several times but can't find what is wrong with my code. Could you please help me? ...
0
votes
1answer
277 views

Pset 4 - Help understanding structs in copy.c

Trying to understand copy.c has been a pain for me so far. I feel complete lost at how the structures from the helper file work in copy.c An example: Helper file: typedef struct { WORD bfType; ...
0
votes
1answer
371 views

determine padding for scanlines in copy.c

Line 65 in copy.c int padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4; Question is why do we need last modulo operator in bold? Even without it, it gives the right answer.
3
votes
1answer
1k views

pset4: resize.c - why is biWidth written as bi.biWidth

I am working on resize.c, and I was wondering why when you set the new dimensions for the bitmap, the width and height in the code are written as bi.biWidth and bi.biHeight. i.e. why do you write: (...
1
vote
1answer
940 views

what's the purpose of fseek in PSET4?

what is the purpose of even using Fseek() in pset 4 anyhow? I must be missing something Say we're looking at the original copy.c function. Basically, this is what I understand what's happening: ...
0
votes
1answer
54 views

Help With pset4 resize please

Can somebody help me understand what's wrong with my code? /** * copy.c * * Computer Science 50 * Problem Set 4 * * Copies a BMP piece by piece, just because. */ #include <stdio.h> #...
0
votes
1answer
194 views

Please explain why copy.c skips over padding and how it then adds it back?

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 ...
-1
votes
1answer
91 views

Dose anyone know where memory allocated in resize.c and copy.c? [closed]

I've checked valgrind resize and found out i have a memory leak , 28 byte lost in 3 blocks to be exact , and i don't know where they are allocated , i think in fread and fwrite , but i dont know how ...
2
votes
1answer
562 views

How do the headers in copy.c update on pset4?

I don't really understand the following code in copy.c: // write outfile's BITMAPFILEHEADER fwrite(&bf, sizeof(BITMAPFILEHEADER), 1, outptr); // write outfile's BITMAPINFOHEADER fwrite(&bi, ...
2
votes
2answers
483 views

How are file data stored in an int buffer?

For example, in copy.c in pset4, how is 0x42 0x4d(ASCII for 'BM') stored in bfType which is of the type uint16_t? It can't be bfType = 0x424d because that is a completely different number. And of ...