Click to See Complete Forum and Search --> : Convert a String to a const char


gfr1
July 14th, 2005, 05:24 PM
I would like to convert a string from a list box to a const char so I can use it in a fopen( ) call any suggestions out there??

Thanks

Jinto
July 14th, 2005, 07:56 PM
String* str = S"somestring";
const char* str2 = (const char*)Runtime::InteropServices::Marshal::StringToHGlobalAnsi( str ).ToPointer( );