/* * printbin.c * I)ruid * * Function to print a buffer as binary. * */ #include #include void printbin( int buf, int totalbits ) { int tmpbuf; int bits; for( bits = totalbits; bits > 0 ; bits-- ) { tmpbuf = buf; tmpbuf = tmpbuf >> (totalbits-1); if( tmpbuf & 1 ) printf( "1" ); else printf( "0" ); buf<<=1; } }