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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -