FIXED SIZE STRINGS

Aug 13, 2010 at 8:17am
Hi,
I want to make bitwise operations on different strings of binary numbers. The main string that i perform bitwise operations on it has 16 binary characters. So in order to perform the operations, the two strings should have the same size. I firstly convert an integer to a string and then perform bitwise operation with the main string. So how do I make sure that the binary equivalent of an integer has exactly sixteen bits.
In short, suppose I have int a = 4; whose binary equivalent is 100, so how do I make it 0000000000000100.

Cheers
Aug 13, 2010 at 8:50am
Aug 13, 2010 at 10:55am
Your suggestion was absolutely useless for me kbw, thank you anyway!
Aug 13, 2010 at 11:07am
You need to format the string. You have to put in a bit of effort to work out how formatting works.
Aug 13, 2010 at 12:29pm
Thank you.
Topic archived. No new replies allowed.