Jul 30, 2009 #1 C Chris90 Newbie level 2 Joined May 11, 2009 Messages 2 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,291 char to binary c Hi, can anyone help me on converting a char array to binary ?? For example, i have char MESS[4] = {"1A,"}; How do i convert this char array to binary ?? I'm currently using C programming . Thanks .
char to binary c Hi, can anyone help me on converting a char array to binary ?? For example, i have char MESS[4] = {"1A,"}; How do i convert this char array to binary ?? I'm currently using C programming . Thanks .
Jul 30, 2009 #2 B btbass Advanced Member level 5 Joined Jul 20, 2001 Messages 1,896 Helped 438 Reputation 880 Reaction score 288 Trophy points 1,363 Location Oberon Activity points 12,887 convert char to binary c++ They are already in binary, its just a matter of interpretation. the char '1' is hex 0x31, or binary 0011 0001 the char 'A' is hex 0x41 or binary 0100 0001 the char ',' is hex 0x2c or binary 0010 1100 etc. your array contains MESS[0x31, 0x41, 0x2c, \0]; C is not strongly typed so unsigned int and char are interchangeable.
convert char to binary c++ They are already in binary, its just a matter of interpretation. the char '1' is hex 0x31, or binary 0011 0001 the char 'A' is hex 0x41 or binary 0100 0001 the char ',' is hex 0x2c or binary 0010 1100 etc. your array contains MESS[0x31, 0x41, 0x2c, \0]; C is not strongly typed so unsigned int and char are interchangeable.
Aug 4, 2009 #3 C Chris90 Newbie level 2 Joined May 11, 2009 Messages 2 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,291 convert char to binary in c Hi , thanks for the reply. I will try and work out the program .