I am new to inter process communication and need some help. I want to be able to send a string from a C++ program to a C# program. My problem is that the resultant string is g
char* in C++ is ANSI character string (usually one byte per character), char* in C# is Unicode character string (like WCHAR* - two bytes per character).
You in fact reinterpret_cast from char* to WCHAR*. This won't work. Use MultiByteToWideChar() on C++ side to convert.
You'll have to convert your character array from ASCII to Unicode somehow. Here is a page that may help do it from the C# side.
Your string in C++ is ANSI. You need to convert to Unicode somewhere for C#. It's been a couple of years since I did interop, so someone else will have to tell you exactly how to do that.