Делал так:
Код:
using namespace System::Runtime::InteropServices;
...
String^ str = textBox1->Text;
IntPtr iptrstr = Marshal::StringToCoTaskMemAnsi(str);
const char* id = static_cast<const char*>(iptrstr.ToPointer());
...
...
Marshal::FreeCoTaskMem(iptrstr);
Ошибки:
Код:
1>c:\documents and settings\nordway\мои документы\visual studio 2008\projects\mysql\mysql\Form1.h(145) : error C2679: binary '+' : no operator found which takes a right-hand operand of type 'const char *' (or there is no acceptable conversion)
1> could be 'built-in C++ operator+(volatile const System::Object ^, volatile const System::String ^)'
1> or 'built-in C++ operator+(volatile const System::String ^, volatile const System::Object ^)'
1> or 'built-in C++ operator+(volatile const System::String ^, volatile const System::String ^)'
1> while trying to match the argument list '(System::String ^, const char *)'
P.S. Объедините в 1 пост, какой-то глюк с форумом был.