Conversion from System::String to char*
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
=*=
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemstringclasstopic.asp
copy or copyTo
copy or copyTo
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement