I just have a couple more errors to get rid of so far:
1>NTS.cpp(132): error C2065: 'cli_msg' : undeclared identifier
1>NTS.cpp(133): error C2660: 'System::IntPtr::ToPointer' : function does not take 1 arguments
I have looked all over the place for the right namespace or #include that will support those identifiers.
#1 cli_msg is just the name I chose for my variable. Use whatever name you used for your variable. (In my easrlier post, I assumed my code fragments ran on from each other).
Alright, the program compiles correctly so far with converting the String to the char. Here is what I put together so far, just to make sure that everything is in its right place:
1 2 3 4 5 6
String^ cli_str = gcnew String(cli_str);
char buffer[1024]; // need to be careful with buffer size in real code
IntPtr hglob = Marshal::StringToHGlobalAnsi(cli_str);
char* str = static_cast<char*>(hglob.ToPointer());
strcpy_s(buffer, str);
Marshal::FreeHGlobal(hglob);
Alright, that issue is done with. Now, I got the textBox linking issue with:
String^ input = this->textBox1->Text = cli_str;
The following compiler errors have occurred:
1>NTS.cpp(106): error C2065: 'str' : undeclared identifier
1>NTS.cpp(113): error C2355: 'this' : can only be referenced inside non-static member functions
1>NTS.cpp(113): error C2227: left of '->textBox1' must point to class/struct/union/generic type
1>NTS.cpp(113): error C2227: left of '->Text' must point to class/struct/union/generic type
Those are compiler errors. To fix them you just need to use the right variable name. And call the functions inside a membe function of the form.
All these error are minor, generic C++ errors. See the cplusplus.com tutorials for information about varaibles and classes (inc. static vs other members)