FIXED SIZE STRINGS

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
Your suggestion was absolutely useless for me kbw, thank you anyway!
You need to format the string. You have to put in a bit of effort to work out how formatting works.
Thank you.
Topic archived. No new replies allowed.