Possible Duplicate:
C++/CLI Converting from System::String^ to std::string
I am using a C# DLL in my C++ code (Visual Studio 2010). How do I convert a System::String^ to a C++ std::string?
Possible Duplicate:
C++/CLI Converting from System::String^ to std::string
I am using a C# DLL in my C++ code (Visual Studio 2010). How do I convert a System::String^ to a C++ std::string?
System.Runtime.InteropServices.Marshal
has several methods that convert a string to an array of characters, which you could then use any manner of methods to get a std::string
.
I believe the recommendation is to use StringToBSTR
eventually calling FreeBSTR
once you have copied the data to a different object.
The question I linked to as a comment recommends StringToCoTaskMemUni
.