[kw-pm] huffman

lloyd carr dcarr at sdf.lonestar.org
Sat Jun 17 19:36:44 PDT 2006


> As usual I am happily distracted from doing anything useful by one of
> fishbot's talks :)
>
> How do you read a file one bit at a time? Can you without going to some
> obscure low level stuff???

http://michael.dipperstein.com/bitlibs/index.html

The answer is to let someone else do it for you. I know it's C, but I now 
have my getbit() function and can use it thus

while ( 1==1 ) {

 	if ( getbit() )

 	{

             if ( getbit() )

             {

                         if ( getbit() )

                         {

                                     printf( "D" );

                         } else {

                                     printf( "C" );

                         }

             } else {

                         printf( "B" );

             }

 	} else {

             if ( getbit() )

             {

                         printf( "A" );

             } else {

                         break;

             }

 	}

}


More information about the kw-pm mailing list