问题描述
我正在调用一个函数,该函数在输出流中输出一个宽字符。考虑:-
wcout<<Getoutput();
而函数的定义是这样的:-
const wchar_t* Getoutput()
{
std::wstringstream stringStream;
stringStream << out_name << " " << out_type << out_subtype;
wchar_t* check = new wchar_t[stringStream.str().length() + 1];
wcscpy(check,stringStream.str().c_str());
return check;
}
现在,当在 cmd 上调用这个函数时,它给了我正确的输出。但是,当在 linux(WSL) 上调用相同的函数时,我得到的输出地址是这样的:-
0x1ef110ad0
为什么会这样?
编辑:- 变量定义如下:-
const std::wstring out_name = L"My Name";
const std::wstring out_type = L"Type1";
const std::wstring out_subtype = L"SubType1";
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)