On 5/3/05, Graham Fawcett <[EMAIL PROTECTED]> wrote:
> On 5/3/05, felix winkelmann <[EMAIL PROTECTED]> wrote:
> >
> > There is now reason not to use C++, though.
> 
> I've started on a little Chicken/OLE example, and have been able to
> get quite far with just C, except for one thing: any idea how to
> create a BSTR value from a Chicken string value?

To answer my own question:

BSTR schemeStringToBstr(char *scheme_string) {
  // don't forget to SysFreeString(retval)!
  int count = strlen(scheme_string);
  BSTR retval = SysAllocStringLen(NULL, count);
  MultiByteToWideChar(CP_UTF8, 0, scheme_string, count, retval, count);
  return(retval);
}

(Sorry for adding noise to the list.)

-- Graham


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to