Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

hammerstein_02

Conversion from System::String to char*

This topic is 5201 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

I have recently begun to work with Visual C++.NET 2003, and as such now have the nice forms designer available to me. As I am not a complete novice at C++ programming, I have decided my first app will be a Mysql interface for a website I am designing. I figured out how to get the Mysql API to compile with my program, but I as I am using managed code I have System::Strings passed to my Mysql interface class. mysql_real_connect() only accepts char* though. I have begun looking, and the simplest solution I found was if( str->Length <= 255){ for( int i = 0; iLength;i++) s = str->get_Chars(i); } There was another one but it used all sorts of functions included dllImport or something, which looked far too complex for what I was actually trying to acheive. So I was wondering if anybody on here had an idea of what I need to do to do this conversion. Oh yeah and it is DEFINATLEY a char* not a Char. Many thanks =*= If things seem bad, think that they can get a whole load worse, and they don''t seem so bad anymore =*=

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
http://support.microsoft.com/?kbid=311259

Share this post


Link to post
Share on other sites
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemstringclasstopic.asp


copy or copyTo

Share this post


Link to post
Share on other sites
Many thanks, that looks like what I am after. I spent many hours trying different combinations and could only find Char conversions, methinks I was looking in the wrong place. But your help is greatly appreciated.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!