I'm trying to do file compression/decompression in C and I need to handle one bit at a time. I've looked around online and haven't seem to found anything that I can figure out how to implement nicely.

I currently try to do:

unsigned char byte = fgetc(fptr);

and later

byte >>= 1;

but the problem is that I have to use the first bit of the byte and then treat the next 8 bits...