String Convertion Problems

  • Thread starter Thread starter Glenn
  • Start date Start date
G

Glenn

I am a new to C++.
I wrote the following code in my function.

BSTR bstr1;
System::String * order[,] = new String* [1000,2];
bstr1 = order[row1,1]->ToString();

When I try to build the function I get an Error saying I cannot
convert from System::String to BSTR on the 3rd line. Is this possible
to convert if so how?

Thanks,
Glenn
 
int _tmain()
{
String* str= "Hello World";
const wchar_t __pin* pin = PtrToStringChars(str);
BSTR bstr = SysAllocString(pin);
// Use the BSTR here
SysFreeString(bstr);
return 0;
}
 
Back
Top