C++ C++/cli将LPCSTR转换为System::String^
我在将LPCSTR转换为System::String^时遇到问题,尽管我可以使用封送处理将System::String转换为LPCSTR 但是如何将LPCSTR转换为System::String^C++ C++/cli将LPCSTR转换为System::String^,c++,string,c++-cli,marshalling,lpcstr,C++,String,C++ Cli,Marshalling,Lpcstr,我在将LPCSTR转换为System::String^时遇到问题,尽管我可以使用封送处理将System::String转换为LPCSTR 但是如何将LPCSTR转换为System::String^ 谢谢事实上,是的,可能是重复的。你真的想在这样简单的操作中增加复杂性吗?String类有一个接受char*输入的构造函数,它将数据复制到找到的第一个空字符。如果数据不是以null结尾的,或者如果您提前知道数据长度,则可以使用其他构造函数:gcnew System::String(lpcstrting,
谢谢事实上,是的,可能是重复的。你真的想在这样简单的操作中增加复杂性吗?
String
类有一个接受char*
输入的构造函数,它将数据复制到找到的第一个空字符。如果数据不是以null结尾的,或者如果您提前知道数据长度,则可以使用其他构造函数:gcnew System::String(lpcstrting,0,length)代码>`
gcnew System::String(lpcstrThing);