在C++中返回一个字符串

问题描述:

我在我的C++中有一个函数,我想返回一个字符串。我尝试了几种方法,但得到错误。我试过了C#的回归方式“....”;返回myString;但每次都会出错。在C++中返回一个字符串

编辑:0000005:访问冲突写入位置0x7a0dcc30

在0x100c1486(DGGGGG.dll)在TestConsoleApp2.exe未处理的异常。

+3

错误?什么错误?不要在你的问题中看到他们... – 2011-02-17 09:45:05

+1

向我们展示一些代码。 – NPE 2011-02-17 09:45:51

std::string methodReturningString() 
{ 
    std::string something = "Hello "; 
    something += "world!"; 
    return something; 
}