How would I convert a String* variable to a char*variable?

string s;

Here's the answer:

String *str1;
char* chars;

str1 = textBox1->Text;

// convert from managed String to char *
chars = (char*)(Marshal::StringToHGlobalAnsi(str1)).ToPointer();

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.