Cannot implicitly convert expression (&sbuf) of type char [1024] to IOREQ *
Anders S via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Nov 29 07:30:33 PST 2016
Hi guys,
I want to write into a fifo pipe using write( ...)
Now a gather my data into my own struct IOREQ so in order to
write I have to cast into an char buffer.
My problem in dlang is that it doesn't accept the casting (IOREQ
*) I get:
Error: Cannot implicitly convert expression (&sbuf) of type char
[1024] to IOREQ*
define FC_GETSTATUS 501;
typedef struct {
SHORT fc; /* function code */
SHORT rs; /* return code */
INT size; /* size of this request, including header */
SHORT src; /* source */
....
INT argv[1]; /* list of arguments */
} IOREQ;
int WritePipe(int fd, int mess, int argc)
{
struct IOREQ * io; // my array of data
char sbuf[1024];
io = (IOREQ *)buf; // Not accepted in dlang
io.fc = FC_GETSTATUS;
io.src = getpid(); // works
..... // add more data
st = write(fd, sbuf, 1024); //
return st;
}
More information about the Digitalmars-d-learn
mailing list