Cannot implicitly convert expression (&sbuf) of type char [1024] to IOREQ *
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Nov 29 15:33:19 PST 2016
On 11/29/2016 07:30 AM, Anders S wrote:
> INT argv[1]; /* list of arguments */
In addition to what Nemanja Boric wrote, the recommended array syntax in
D is the following:
INT[1] argv;
> char sbuf[1024];
> io = (IOREQ *)buf; // Not accepted in dlang
You must use the cast keyword, the pointer to first element of an array
is .ptr, and I think you meant sbuf:
io = cast(IOREQ *)sbuf.ptr;
> st = write(fd, sbuf, 1024); //
You can use the .length property of arrays:
st = write(fd, sbuf, sbuf.length);
Ali
More information about the Digitalmars-d-learn
mailing list