Reading bit by bit from a binary file with C -


i need read 256 bit each step until binary file ends.is there operation in c read bit bit? use fread function , read 32 chars. chars shift bit bit 8 times. after reading ı write 256 bits file. ı have same thing write? mean ı write 32 chars => 32*8 = 256 bit.

no, minimum item can read or write char (and keep in mind that's not necessarily 8 bits, depends on implementation). if want manipulate parts of char once have in memory, you'll need use bitwise operators sich &, | << , >> (and, or , left/right shift).

and yes, can fwrite write arbitrary number of characters (in same manner use fread read them).


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -