return a string in C++
I have a function in my C++ where I would like to return a string. I have tried a few ways but get errors. I've tried the C# way of return "...."; return myString; But get errors every time.
EDIT:
Unhandled exception at 0x100c1486 (DGGGGG.dll) in TestConsoleApp2.exe: 0xC0000005: Access violation writing locat开发者_JAVA百科ion 0x7a0dcc30.
std::string methodReturningString()
{
std::string something = "Hello ";
something += "world!";
return something;
}
精彩评论