If you want to get eight characters (bits) at a time from the input you read, then you should use the ...
stackoverflow.com