at 1:15, the "last byte" should either say the "last byte of header" or "fourth byte" to be more clear. If not for the conditional statement given later the video I would have thought, the last byte of the entire JPEG was the value given, rather than the last byte in the header.
a single ampersand (&) is a bitwise function: it basically takes the binary forms of two numbers (in this case buffer[3] and 0xf0) and returns the result of whether each digit is a 1 or a 0. (i.e., if the first digit of both numbers is 1, it will return one as the first digit; if either or both of the first digits are 0, it will return 0 as the first digit; and so on.) (buffer[3] & 0xf0 == 0xe0) will return as true only if the first three digits in buffer[3] are all 1s and the fourth digit is 0. the test does not care about the second half of the hexadecimal of buffer[3] because no matter what it will return zero because it's being compared with 0xf0. so basically this is a way to test if the first half of buffer[3] is 0xe, notwithstanding whatever's in the second half. :)
should i be able to write this program at this stage of course?
at 1:15, the "last byte" should either say the "last byte of header" or "fourth byte" to be more clear. If not for the conditional statement given later the video I would have thought, the last byte of the entire JPEG was the value given, rather than the last byte in the header.
1:27 She did say that.
You are right.
fread(buffer, 512, 1, card) returns 1 if it manages to read it.
Could someone explain why the conditional at 4:39 evaluates to true?
a single ampersand (&) is a bitwise function: it basically takes the binary forms of two numbers (in this case buffer[3] and 0xf0) and returns the result of whether each digit is a 1 or a 0. (i.e., if the first digit of both numbers is 1, it will return one as the first digit; if either or both of the first digits are 0, it will return 0 as the first digit; and so on.) (buffer[3] & 0xf0 == 0xe0) will return as true only if the first three digits in buffer[3] are all 1s and the fourth digit is 0. the test does not care about the second half of the hexadecimal of buffer[3] because no matter what it will return zero because it's being compared with 0xf0. so basically this is a way to test if the first half of buffer[3] is 0xe, notwithstanding whatever's in the second half. :)
Dig into the card.raw a little and look at the first few bytes in the 2nd 512 byte block for a treat
how u do it?
OMG, "Death Sphere"!!!))))))
Well, what's in card.raw? What is the type of buffer?
OK. It's a char.
Now I don't understand how to stop writing bytes into a jpg, close it and start a new one.
Did it! Pset3 is now completed. That was not so funny actually. But great practice.
Congrats
Can someone explain the sprintf function?
It stores and formats an output into a pointer(string or array of chars). In this problem, you'll use it to store and format the name of the file.
@@shoaib3356 OK thanks
Just as printf evaluates and shows into the screen, sprintf evaluates and stores into an string thats referenced in the first argument.
can any one code this program??
Yeah, i can