Hello!
I am not a wizard in this area! Just need some help out in this. I am trying to convert bstr string to new character string. Here is the snippet of my code.
**** Code Start****
GlobalInterfacePtr->GetName(bstr, bstrTNamePtr, &retVal);
wcscpy (wstr1, *bstrTNamePtr);
char text2[20];
WideCharToMultiByte (CP_ACP, 0, wstr1, -1, text2, sizeof (text2), NULL, NULL);
**** Code END****
What I am doing in this code is getting a string value from the C#.NET to VC++ . The C# .NET sends the correct string value. When VC++ receives it, it comes up with a junk value for the string "Text2". I scripted this code with the help from MSDN. Dont know why I am geting the junk value. I guess the conversion to new character string is not done properly. This code was working two months back. I dug it out to polish it here and there. But, it would not work. I would apprecite if anyone could help me out here!!!
Thanks a much!
Karthik
I am not a wizard in this area! Just need some help out in this. I am trying to convert bstr string to new character string. Here is the snippet of my code.
**** Code Start****
GlobalInterfacePtr->GetName(bstr, bstrTNamePtr, &retVal);
wcscpy (wstr1, *bstrTNamePtr);
char text2[20];
WideCharToMultiByte (CP_ACP, 0, wstr1, -1, text2, sizeof (text2), NULL, NULL);
**** Code END****
What I am doing in this code is getting a string value from the C#.NET to VC++ . The C# .NET sends the correct string value. When VC++ receives it, it comes up with a junk value for the string "Text2". I scripted this code with the help from MSDN. Dont know why I am geting the junk value. I guess the conversion to new character string is not done properly. This code was working two months back. I dug it out to polish it here and there. But, it would not work. I would apprecite if anyone could help me out here!!!
Thanks a much!
Karthik