0

I try to concatenate some bits with the array of type uint8_t in c,as:

int main(int argc, char **argv) {
    if(argc < 2) {
        printf("Usage: %s <Input _message>\n", argv[0]);
        return -1;
    }
     uint8_t L_length_of_message =strlen(argv[1]);
     num_0's_in_bits_addedd=13; // try to || 13 bit with array
     uint8_t msg[L_length_of_message]; 
//assume this msg is already converted in hex format

Now i,e msg=0xabcf123; and i want concatenate 13(bits) with msg i,e;

  msg=0xabcf123;
  msg_in_bits=1010101111001111000100100011
  zeors_added_in_bits=0000000000000;
  new_msg_in_bits=10101011110011110001001000110000000000000;
  new_msg=0x1579e246000

The major problem is the message is stored into a char array, so shift operation for multiple bits is not working. suggest some solution for the problem??

AR.5
  • 101
  • 6
abbasi_ahsan
  • 340
  • 1
  • 11

0 Answers0