As far as I know the smallest unit in C is a byte
. Where does this constraint comes from? CPU?
For example, how can I write a nibble
or a singl
Moreover data is written to files in sectors (e.g. 512 bytes or so). And if we need to change only one byte the whole sector is read, patched and written back.
But you don't need to thinkabout sectors. To Change one bit just seek to apropriate byte position in file, read that byte, change the bit and write the result back.