Usage of std::string.append causes "Stack around the variable 'result' was corrupted"
- by Yan Cheng CHEOK
I have the following code :
std::string Utils::get() {
std::string result;
result.append(1, 'x');
result.append(1, 'x');
result.append(1, 'x');
return result;
}
I expect 'xxx' to be returned.
However, when I run under debug mode, I get the warning
"Stack around the variable 'result' was corrupted"
Am I using append function the wrong way?