Found in CodeComics.com

A function that returns a string which represents the binary of an integer
[c]
char *getBinaryFormat (unsigned int *input, char *binary)
{
int pos = 0;
int i;
/* fill binary backwards */
for (i = 31; i >= 0; i–) {
if (((*input >> i) & 1))
binary[pos]=’1′;
else
binary[pos]=’0′;
/* Format output using dots
if ((i > 0) && ((i) % 4) == 0) {
pos++;
bitstring[pos] = ‘.’;
}
*/
pos++;
}
binary[pos] = ‘