Say I have the code:
std::string str = "random";
function(str);
void function (std::string str)
{
std::cout << str << std::endl;
}
If I step through this code in gdb and then go into the function and do p str
it would print out something like this \362\241
but the cout will print to the screen the correct string random
. Has anyone seen this before if so what should I do? Am I using the print command wrong in gdb or does it have something to do with how the compiler interprets the string?