Bytes to Binary in C
问题 I'm trying to simply convert a byte received from fget into binary. I know the value of the first byte was 49 based on printing the value. I now need to convert this into its binary value. unsigned char byte = 49;// Read from file unsigned char mask = 1; // Bit mask unsigned char bits[8]; // Extract the bits for (int i = 0; i < 8; i++) { // Mask each bit in the byte and store it bits[i] = byte & (mask << i); } // For debug purposes, lets print the received data for (int i = 0; i < 8; i++) {