Truncated string passed from C++ to C# in PPC
Hello,
I've just started experimenting with passing strings and converting them from ascii to unicode.. and have encountered some difficulties..
1) I'm trying to pass a string from C++ to C#. But somehow, the 1st 8 bytes always go missing.Does anyone know why?
C++ code:
extern "C" __declspec(dll export) TCHAR* _stdCall f1
{
return L"write some words..";
}
C# code:
[DllImport("test.dll", CharSet = CharSet.Auto)]
public static extern string f1();
char[] cArray = new char[20];
string s = new string(cArray);
s = f1();
The result of s would be: e some words..
2) Does anyone know how to convert ASCII to Unicode in C? Unlike C++, I can't seem to use TCHAR, LPCWSTR, etc.. in C.
Thanks in advance!

