开发者

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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜