Is there an equivalent to toStringz for wide strings?

Andrej Mitrovic none at none.none
Mon Apr 4 16:17:02 PDT 2011


I think I'd need a toWStringz function, or maybe toStringz can be made more clever and figure out that I'm passing a wstring and return a null-terminated wchar*.

Currently I'm using wstrings and appending the null terminator by hand, e.g.:

wstring appName  = "DMapp" ~ "\0";

Some WinAPI functions in unicode form, such as CreateWindowExW, expect a wchar*. So in the above case I just pass `appName.ptr`. But it would be convenient not having to append the null terminator prematurely.


More information about the Digitalmars-d-learn mailing list