• Advertisement
Sign in to follow this  

converting a String* to a std::string

This topic is 4260 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

in the .net enviroment is it possible to convert a String* to a std::string i need to do it so i can do an ofstream if anybody could help me i would appreciate it

Share this post


Link to post
Share on other sites
Advertisement
it's possible but ugly...


String dotNetString;
std::string cppString(static_cast<char*>(Marshal::StringToHGlobalAnsi(dotNetString).ToPointer()));


warned you it wasn't pretty!!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement