Convert System::String to unsigned Char Array

I have looked at many fourms and found many theories on the conversion from marshal strings to pointer but no actual working code example. What I need to do is take a System::String (i.e. textbox1->text) and convert to a unsigned char array (i.e. unsigned char message[41]). I have tried for 24 hours every possible combination I can think of inside Visual Studio 2008 but constantly get compile error that it can not convert the System::String. If anyone has an actual working example for C++ inside Visual studio 2008. Please reply with the example code not a theory on use pointer or marshal the string. I have tried the theroy and could not get them to compile without error so I just want an example at this point.

At the end what I want is this. textbox1->text = "Hello"
after conversion


message[0] = 0x48
message[1] = 0x65
message[2] = 0x6C
message[3] = 0x6C
message[4] = 0x6F


Thanks
Last edited on
Topic archived. No new replies allowed.