I've to copy a std::string to ASCII ... but with only 7bit ASCII in memory. So this 8-Character string should fit into this 7-Byte/56Bit array.
std::string str = "12345678";
unsigned char ascii_destination[7];
I can grap every character from str and copy it with bit operations to its destinations but I was wondering if there is something more elegant to convert longer string to 7bit in memory? And I havn't found any built in functions for that... Thank you!
std::bitsetthere aren't many easy way to manipulate bits besides working with data sized with full bytes directly and masking them to suit your needs.