On Wednesday, 23 January 2019 at 10:44:51 UTC, Jonathan M Davis wrote:
On Tuesday, January 22, 2019 2:49:00 PM MST bauss via Digitalmars-d-learn wrote:

toUTFz is the generic solution. toStringz exists specifically

Error: template std.utf.toUTFz cannot deduce function from
 argument types !()(string), candidates are:
E:\D\DMD2\WINDOWS\BIN\..\..\src\phobos\std\utf.d(3070): std.utf.toUTFz(P)

I have solved the problem in this way:

import core.sys.windows.windows;
import std.stdio;
import std.string;
import std.conv;

void main()
{
        auto    strA_Z ="CD"w;
        auto type = GetDriveType(tos(to!wstring(strA_Z[0])~":\\"));
        writeln(to!wstring(strA_Z[0])~" is ",type);
}

private auto tos(T)(T str)
{
 version (ANSI)
 {
        writeln("ANSI");
        return cast(const(char)*)(str);
 }
 else
 {
        writeln("Unicode");
        return cast(const(wchar)*)(str);
        
 }
}

Thanks.

Reply via email to