Char * character and string
Chris Pons
cmpons at gmail.com
Thu Mar 1 21:22:41 PST 2012
Thank you for the reply. However, I've run into another problem.
I changed:
-----------
char * file;
this()
{
this.filename = "test.bmp";
}
---------------
To:
----------------
char * file
this()
{
this.filename = toStringz("test.bmp");
}
-----------------------
I am getting this error:
Error 1 Error: cannot implicitly convert expression
(toStringz("test.bmp")) of type immutable(char)* to
char* D:\Documents\Projects\Test\Test\DPBall.d 10
Instead I tried toUTFz, which I used like this:
--------------------------
char * filename;
this()
{
this.filename = toUTFz("test.bmp");
}
--------------------------
I get these errors:
Error 1 Error: template std.utf.toUTFz(P,S) if (isSomeString!(S)
&& isPointer!(P) && isSomeChar!(typeof(*P.init)) &&
is(Unqual!(typeof(*P.init)) == Unqual!(ElementEncodingType!(S)))
&& is(immutable(Unqual!(ElementEncodingType!(S))) ==
ElementEncodingType!(S))) does not match any function template
declaration D:\Documents\Projects\Test\Test\DPBall.d 11
Error 2 Error: template std.utf.toUTFz(P,S) if (isSomeString!(S)
&& isPointer!(P) && isSomeChar!(typeof(*P.init)) &&
is(Unqual!(typeof(*P.init)) == Unqual!(ElementEncodingType!(S)))
&& is(immutable(Unqual!(ElementEncodingType!(S))) ==
ElementEncodingType!(S))) cannot deduce template function from
argument types
!()(string) D:\Documents\Projects\Test\Test\DPBall.d 11
Am I using these functions incorrectly?
More information about the Digitalmars-d-learn
mailing list