I am using Windows Forms C++/CLI and have a function that calls a Python script which returns a string representation of bytes. I would like to convert the string to an array of bytes.
For example:
String^ demoString = "09153a"; // example of data returned from Python script
array<Byte>^ bytes;
// This is what I tried but does not give me the output I want
bytes = System::Text::Encoding::UTF8->GetBytes(demoString);
unsigned char zero = bytes[0];
unsigned char one = bytes[1];
unsigned char two = bytes[2];
unsigned char three = bytes[3];
this->richTextBox1->Text += zero + "\n";
this->richTextBox1->Text += one + "\n";
this->richTextBox1->Text += two + "\n";
this->richTextBox1->Text += three + "\n";
What this ends up printing to the text box is the decimal representation of the ascii characters:
48
57
49
53
What I am trying to get is an array with the values {0x09, 0x15, 0x3a};