I am trying to write one byte to a file in C++. When I save it, is is 8 byte large, instead of 1 byte. How can I save exactly one byte?
ofstream binFile("compressed.bin", ios::out | ios::binary); bitset<8> a("10010010"); binFile << a; Output of ls -la:
.rw-r--r-- name staff 8 B Sat Dec 4 23:26:18 2021 compressed.bin How can I small it down to one byte?
compressed.bin, converts to an integer, and streams that to the screen (don't forget a space between numbers).charinstead, as that is the range of printable characters.