>> [MUSIC PLAYING]
>> ROB BOWDEN: Hi.
I'm Rob, and let's find out who done it.
So, starting with the template that copy.c already gives us, we see that
most of the code is going to be the same.
We are going to check to make sure there's an infile and outfile
specified at the command line, we're going to open the infile for reading,
we're going to open the outfile for writing, and finally, we're going to
read in the infile's headers, check to make sure it's a valid bitmap, write
the headers to the outfile, just as copy.c has done, and we're going to
iterate over the infile scan lines in pixels.
>> And now we see the only change in this file.
So, we read in a triple from the infile as copy.c does, but instead of
immediately writing the triple to the outfile, we're going to change the
pixel data.
So we're going to set the blue data to just 0, we're going to set the green
to 0, leaving us with only the red, and then we're going to write that to
the outfile.
And then the padding is going to be exactly the same as it was in copy.c.
Finally, close the files, return 0.
>> So, let's see what happens.
Let's make whodunit, ./whodunit, clue.bmp, and lets reveal that bitmap.
Let's look at the file.
And we see Milo Banana dun it.
My name is Rob, and this was whodunit.
>> [MUSIC PLAYING]