convert and assign to the BSTR char

John C johnch_atms at hotmail.com
Sat Apr 18 08:59:58 PDT 2009


new Wrote:

> hi,
> 
> how does one convert char[] to BSTR and back? i am looking to use a dll that contains function such as
> 
> BSTR tester = gettest(BSTR *in, BSTR in1);
> 
> any help is appreciated.

  wchar* bstr = SysAllocString(std.utf.toUTF16z(s));

and

  char[] s = std.utf.toUTF8(bstr[0 .. SysStringLen(bstr)]);
  SysFreeString(bstr);


More information about the Digitalmars-d-learn mailing list