Is there a way to force string use unsigned char instead of char? Perhaps in constructor?
I need to do arithmetic operations (mostly incrementing, decrementing, ~ (bitwise NOT)), and I need to be able to use overflow 255++ == 0... Not 127++ == -128 (and underflow 0-- == 255...)
I am not sure if question makes sense, to put some light on it here is a good question abou topic (streams) Why do C++ streams use char instead of unsigned char?
I am not trying to convert string to unsigned char I found a lot of questions how to convert between the two.
You can use:
typedef std::basic_string<unsigned char> ustring;
And then use ustring instead of std::string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With