c++ - warnings: comparison between pointer and integer, passing argument 1 of ‘read’ makes integer from pointer without a cast -


when compiling program named online_ana.c (by running makefile) following lines:

******#define fifo1 (getenv("fifo1"))****** file *fifofile;  54 : if ((fifofile = fopen((fifo1!=null) ? fifo1 : "fifo1", o_rdonly)) == -1)  153 : if ((read(fifofile, &bufferheader, sizeof(struct event_header))) != sizeof(struct event_header))  168 : if ((read(fifofile, &mybuffer[cnt], 4*bufferheader.n_sca)) != 4*bufferheader.n_sca)  189 : if ((read(fifofile, &mybuffer[cnt], 2*(bufferheader.n_adc+bufferheader.n_tdc+bufferheader.n_pcos))) != 2*(bufferheader.n_adc+bufferheader.n_tdc+bufferheader.n_pcos))   encountered such warnings:  online_ana.c:**54**:69: warning: comparison between pointer , integer [enabled default] online_ana.c: in function ‘getbufferfromfifo’: online_ana.c:**153**:52: warning: passing argument 1 of ‘read’ makes integer pointer without cast [enabled default] /usr/include/unistd.h:361:16: note: expected ‘int’ argument of type ‘struct file *’ online_ana.c:**168**:7: warning: passing argument 1 of ‘read’ makes integer pointer without cast [enabled default] /usr/include/unistd.h:361:16: note: expected ‘int’ argument of type ‘struct file *’ online_ana.c:**189**:7: warning: passing argument 1 of ‘read’ makes integer pointer without cast [enabled default] /usr/include/unistd.h:361:16: note: expected ‘int’ argument of type ‘struct file *’ 

what wrong? hope can me. in advance!!

mostly warnings because pass file* (a pointer) function expects integer argument. warning fopen it's because compare pointer (file*) integer (-1).

in other words, mixing 2 different i/o systems.

either should use posix function open , read, or use c functions fopen , fread. don't mix.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -