On Sunday, 30 September 2018 at 06:56:41 UTC, bauss wrote:
There is function that does it for you called toStringz()

https://dlang.org/library/std/string/to_stringz.html

Not really best for Windows. That's for calling C functions with char*, for Windows, you should be working with wchar* instead.

http://dpldocs.info/experimental-docs/std.utf.toUTFz.html

so usage is:

toUTFz!(wchar*)(your_string_here);


If passing string literals to Windows, you can put a w at the end, like:

MessageBoxW(null, "Hello"w, "World"w, 0); // note the ""w

Reply via email to