c - Storing the lowest level bits and returning a char -
I am working on assignments that decode hidden messages stored in a ppm format picture. The first thing I need to do is the length of the message, which is hidden in a byte spread over 8 data bytes before the picture. After I have this, my argument is to make a method where I have a loop that changes bits 7 spots, first records one, and when there are 8 bits, then returning four representing them . So right now I am trying to understand how it will work. I was trying to get the value for the length of the hidden message I have tried to manually see how the behavior of all the bits happened. So when the minimum level of length 8 bytes is hidden in bit i fgets (str, 64, fp); And then every 8th value is stored in an array. It gives "enpm0dp" when I changed the array to int, then the output was an arrow. Can anyone tell me how to store bits in a byte and then match this value? Do I use an array of 8 bits? Or stored them in a string? You think that After this, you think that the You have to consider an array of characters, which we will consider bytes: fgets (str, 64, fp); Four lengths [7]; Length [0] = str [7]; Length [1] = str [15]; Length [2] = str [23]; Length [3] = str [31]; Length [4] = str [39]; Length [5] = str [47]; Length [6] = str [55]; Length [7] = str [63]; printf (length);
fgets () calculates the length in the bits (64 for 8 bytes), but it's not really; See it is counted in characters.
str is bits of bits, but arrays of bits are not present in C.
unsigned char letters [8]; If (fgets (str, sizeof str, fp)) {unsigned char length = 0, i; For (i = 0; i
Comments
Post a Comment