Revision: 35422
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 8, 2010 05:27 by FACastello
Initial Code
#include <stdio.h> #include <limits.h> // Convert a char to a binary string representation of that char value char* chartobin ( unsigned char c ) { static char bin[CHAR_BIT + 1] = { 0 }; int i; for ( i = CHAR_BIT - 1; i >= 0; i-- ) { bin[i] = (c % 2) + '0'; c /= 2; } return bin; }
Initial URL
Initial Description
Initial Title
Convert a char to a binary string representation
Initial Tags
Initial Language
C++