18 votes
Accepted

How does fread progress through each byte in copy.c?

When you open a file a cursor is set somewhere in it (look at man fopen for more about that) and you can change this cursor position using fseek. When you read a "block" (in your case you read sizeof(...
user avatar
  • 198
8 votes

Cannot use make: "Nothing to be done for whodunit.c"

You are most probably doing make whodunit.c which should be make whodunit I also often get confused with these. So there is a way to think for it, always remember, you want to create executable ...
user avatar
  • 3,316
7 votes
Accepted

Pset4 Whodunit: Any way to enhance the image?

I got the same picture! After tweaking, I found that the reason why it's so light and hard to see is because all the coloured pixels are very close to white. What I mean is each pixel has an rgb that ...
user avatar
  • 86
7 votes

Pset5 - Whodunit

The image has a "secret" message on it, but the message is hidden by random pixels. We need to clean all the noise (the red pixels) and find the hidden message of whodunit. Pixels of an image are ...
user avatar
  • 1,156
5 votes

How does fread progress through each byte in copy.c?

how does freed know to read one byte after another? It's essentially the definition of fread(): size_t fread ( void * ptr, size_t size, size_t count, FILE * stream ); Reads an array of count ...
user avatar
  • 18.3k
5 votes
Accepted

Need help, on pset4, whodunit. I am trying to change all instances of red to white

Black is represented by all three RGB elemments set to 0 or minimum value, or no color. White is the maximum color. If you want to change a pixel to white, you need to change all 3 elements to 0xff: ...
user avatar
  • 63.1k
3 votes

Need help, on pset4, whodunit. I am trying to change all instances of red to white

Each part of the RGBTRIPLE can be 0xff, 0x00, 0xf0, or 0x0f. They can't be 0x000000- that's for the whole triple.
user avatar
  • 1,211
3 votes
Accepted

Person in pset4 whodunit

The person should be recognisable as one of the members of staff. What he's holding is probably a bit more obscure. As long as you've figured out how to actually change some of the pixel values to ...
user avatar
  • 18.3k
3 votes
Accepted

whodunit section

I would say do not spend time worrying about how to fill in those 18 questions right now. Its simply a waste of time. What you should do is complete the whodunit lab first. Start by watching the ...
user avatar
  • 305
3 votes
Accepted

pset4 whodunit question with !==

The comparison operator is != not !==.
user avatar
  • 18.3k
2 votes
Accepted

fseek in pset4(whodunit)

Given that padding cannot be read by fread Who says the padding can't be read by fread? Of course it can and that's the main reason you need to skip it — in order to make fread read the first pixel ...
user avatar
  • 17.4k
2 votes
Accepted

What is the value of green and blue?

The RGBTRIPLE is a struct that contains 3 bytes: rgbtRed rgbtGreen rgbtBlue If the value of any of these triples is 0x00, then that means that color is not in the pixel. Thus, if I had an RGBTRIPLE ...
user avatar
  • 293
2 votes
Accepted

why does the picture become "more" red in whodunit?

When you try to remove the red pixels from the image, what you're really trying to do should be to convert the red pixels into white pixels. So it's useful to know... a black pixel is Red = 0x00, ...
user avatar
  • 36
2 votes

Pset4 Whodunit: Any way to enhance the image?

If by enchancing you mean making the colors stronger, you can. What differentiates each of these tones of blue, if you think of the RGBTRIPLE structure? On the "stronger" pixels, the value of blue is ...
user avatar
2 votes
Accepted

Verdict.bmp: image not clear && no such person seen anywhere in course material

As long as you can recognize a human face in the image, you're fine. If you don't recognize who the particular face belongs to, recall that in Problem Set 2, after correctly implementing your Caesar ...
user avatar
2 votes

Pset4 Whodunit: Any way to enhance the image?

Actually this image can be slightly better enhanced by setting different values for the three color components, I've searched the RGB value of human face (I think this guy is a white guy so I searched ...
user avatar
2 votes

Why is file pointer null on Whodunit and how can I fix?

Are your files actually named infile and outfile? Shouldn't you be running it with clue.bmp and verdict.bmp as the problem set describes? ./whodunit clue.bmp verdict.bmp In gdb, that means this: ...
user avatar
  • 18.3k
2 votes

Pset 4: Whodunit Red to white

I'm not going to spoil the answer for you, but I'll share the line of reasoning that helped me to "get the red out" of the image. Think about this. The hexadecimal RGB representation of black is #...
user avatar
  • 3,035
2 votes

Pset4 whodunit yellow background

if( (triple.rgbtBlue=0x00) && (triple.rgbtGreen=0x00)&& (triple.rgbtRed=0xff) ) What is the difference between an assignment operator, = and an equality test operator, ==? What ...
user avatar
  • 63.1k
2 votes
Accepted

pset4 whodunit should it be clear as day?

Yes, what students normally get is a picture like you're describing. You can, if you want, try to improve contrast. It is also possible to recover that pic perfectly in grayscale, but that's a ...
user avatar
2 votes

what's the picture I should see

clue.bmp has changed. From the spec: When submitting this problem, you’ll be asked whodunit! Your result will enable you to answer the question.
user avatar
2 votes
Accepted

copy.c of pset4>>whodunit not creating perfect copies

Looks like there are "stray bytes", presumably at the end of clue.bmp. When it's opened in the IDE, clue.bmp is 640W * 480H. The filesize should be 54 + (640 * 3) * 480 which is 921,654 bytes. ls -l ...
user avatar
2 votes
Accepted

pset4 WHODUNIT Is there a way to wget the files on the CS50 IDE?

I did that before. The sources for the lab are at https://github.com/cs50/labs/tree/2019/x/whodunit. Make a new directory, open a terminal there, then execute wget https://raw.githubusercontent.com/...
user avatar
  • 20.7k
1 vote
Accepted

Pset 4: Whodunit Red to white

It turned out that I needed to change the location of my code. I had to have the fread command before it! Thank anyway for the help!
user avatar
1 vote
Accepted

pset4 - Whodunit. Pale colors

Go look at how color values work. If the shades are light, how might you enhance or change those values to see what they look like? You'll need to read up a bit more on RGB color and changing triple ...
user avatar
  • 301
1 vote

Pset4 whodunit question

Think about what your test is saying: if(triple.rgbtBlue != 0xff && triple.rgbtRed!= 0xff && triple.rgbtGreen != 0xff){ This will be true only if all three triples are not 0xff. If ...
user avatar
  • 63.1k
1 vote

Whodunit TO DOs

I have the same problem. After removing the 0xff red pixels I tried changing all remaining colored (all non-blank) pixels to black but that was definitely worse. Maybe that was going overboard. My ...
user avatar
1 vote

Red has been turned to white, now how do I turn blue to black?

Remember that white is represented by ffffff or when red, green, and blue are all 0xff. So when you search for triple.rgbtBlue == 0xff, you will also find all the pixels colored white. That's why ...
user avatar
  • 11
1 vote

Red has been turned to white, now how do I turn blue to black?

I'm guessing your error is about comparing a constant to triple.rgbtBlue. Keep in mind that triple.rgbtBlue is just a byte; its values don't range from 0x000000 to 0xff0000, but rather from 0x00 to ...
user avatar
  • 188
1 vote
Accepted

Why is diff showing two identical bmps different?

I just checked and apparently this is the answer. that is, the program that was used to create clue.bmp added 2 bytes at the end of the file. copy.c does not assume there are any additional bytes ...

Only top scored, non community-wiki answers of a minimum length are eligible