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;
}

Reply via email to