Hi,
can someone give a brief explanation of so called top level objects (with ^ near type) that appears in windows form applications? I'd appreciate that.
Also, how do I convert String^ to *char? Typecast don't work, nor the c_str(), or i'm using them wrong.
Windows objects are accessed by handles, which is, in Win32, a better choice than a pointer.
Something like String^ s; declares a handle to a 'String' object.
The problems with the MS approach are the same as the advantages: the code is not portable, but it capitalizes on the Windows architecture.
The String class is an older MS C++ creation than the std::string class. To convert it to a char*, you need to use one of the supplied methods. http://support.microsoft.com/kb/311259
The simplest method might just be to use the CString class, but the StringToHGlobalAnsi() method is also useful.
The marshal context is a newer way of doing it... as was noted in the link I posted...
If you are working with anything older, you might want to try one of the two methods I suggested.
Sorry, I was put off by the "The String class is an older MS C++ creation than the std::string class" and did not think you were talking about system::string from .net and so did not look at your link.
But in the server output i only get unrecognizable characters, the same as i would not do any conversation but pass String^ type data to Issiusti() and then just typecast inside the send(). Why isn't this conversion working? I also tried StringToHGlobalAnsi() as Duoas suggested but the result was the same.