It is possible to write less than 1 byte to a file

Viewed 7963

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 single bit to a file?

4 Answers

The smallest you can get is 1 byte. That's as much as one 1 in binary. If you save a file called binary.bin that just contains a 1, that will take 1 byte

Related