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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -