On a side note, a byte is not always 8 bits...
Here is code I wrote that uses the correct byte size depending on ur system...Quote:
static int size = sizeof(unsigned long) * 8;
template <typename ChildType>
string ConvtoBin (ChildType eData)
for (int a = sizeof(eData) * CHAR_BIT; a > 0; a--)
bits += ((eData >> a) & 1) + 48;