How/why can toStringz() and toUTFz() be used as properties?

ollie ollie at home.net
Fri Apr 26 09:49:30 PDT 2013


On Fri, 26 Apr 2013 09:31:54 +0200, Trey Brisbane wrote:

> I need to understand this, as I wish to write a function toWinStr() that
> can be used in the same way which will accept any string type, and,
> based on something like version(Unicode) and const-ness, output a WinAPI
> LPSTR, LPCSTR, LPWSTR or LPCWSTR as appropriate.
> Is such a thing possible?

You might want to look at std.windows.charset. You'll find the following 
functions:

	const(char)* toMBSz(in char[] s, uint codePage = 0)
	string fromMBSz(immutable(char)* s, int codePage = 0)

These might work for you or you may be able to expand on them.


More information about the Digitalmars-d-learn mailing list