Though I know C well, I'm having trouble with copying a char array to a System::String (not a C++ std::string) in C++/CLI.
I'm using (for the first time) Visual Studio with its drop-and-drag form design feature to create a C++ Windows GUI program. The program works mostly, but I'm having trouble copying a char array (created with sprintf) to a System::String (the type used by many of the Visual Studio controls).
I tried writing this function:
private: System::String^ cts(char *aa) { // convert char[] to String
int i;
String^ s;
s = "";
for (i = 0; aa[i]; i++)
s = s + aa[i];
return s;
}
But cts("h") returns "104" (the ASCII code for lower case h), and I want it to return "h" in String format.
Help would be appreciated.