If it was a space, you wouldn't have a problem. I'm guessing you have an actual \0 character, which is not at all like a space, really.
Are you still doing those debug print statements I see posted here? Is o short, or just o.c_str? If your strings are always supposed to be the same length, you could do
Code:
for (int k = 0; k < string_length; k++) {
cout << static_cast<int> o[k] << " ";
}
to see the actual values of the characters.
Yep I am, that was where I got these from:
Normal String: ",1 2 3m4 5 6 7 8 q X - = [ ].C ' # f . /"
Converted: ",1 2 3m4 5 6 7 8 q X -"
Thanks for the help, I will try what you suggest and see what I get
Thanks so much you were right, turns out the range of random numbers I was generating was one larger than my character dictionary, so every now and then it would reach outside it and get that \0 value