System String and Std String Conversation

i have a std string variable in which i want to enter system string^ value..
how to do it? how to convert?

example:

string a;
String^ b;

a = b; // its error since it cannot convert from System String^ to std string.

im trying:
a = Convert::ToString(b);

but im getting
error while trying to match the argument list '(std::string, System::String ^)'
Last edited on
What is this System::String?

----------
If you manage to obtain a null-terminated char array you can construct a std::string from that.
You'll have to do some more fancy marshaling than that to get a System::String into an std::string. I found some possible answers here:
http://stackoverflow.com/questions/946813/c-cli-converting-from-systemstring-to-stdstring

@maeriden
I'm assuming he's doing .NET interop, which means he's using C++/CLI instead of pure C++.
actually im doing graphic programming with C++ (GUI-forms) applications
Last edited on
Yes. Windows Forms is an API included with .NET. In order to use this API with C++, you actually are using C++/CLI instead of native C++. Hence, the System namespace and the caret ^ character to signify managed pointers (instead of * used for native pointers).
Topic archived. No new replies allowed.