I have a large (122k length) string of 0s and 1s (010011101...) that needs to be written to a binary file as 0s and 1s and not their character representations.
What I've tried:
- Outputting a Binary String to a Binary File in C++ - This is a good solution, however, I will have multiple strings of varying sizes and bitset needs a size at runtime as far as I know.
- Stanford C++ library has a writebit function which works, but this takes way, way too long since each bit opens a write function.
- different ways of implementing outputfile.write(), but they all write the character representations of the 0s and 1s.
Ideally, I'd rather use standard libraries. Thank you for any help in advance.