Re: open FIFO erro
- From: jasen <jasen@xxxxxxxxxxx>
- Date: 27 Sep 2006 10:46:48 GMT
On 2006-09-25, freegnu <freegnu@xxxxxxx> wrote:
hi all , i have a test program, which the prarent process write "hello
world" to a FIFO , and the child process read it form the FIFO,and printf it
on the screem.
but when i run the test program, it open the FIFO,there some problem happen.
the prarent process hand up on open(), and
the child process has error take place
You must open the fifo for reading before you attempt to write to it for writing.
man 3 mkfifo
man 4 fifo
It's probably safest to open it before the fork and then close the reader
in the fork where it's not needed.
also.
if(EEXIST == errno)printf("pEEXIST\n");
if(EACCES == errno)printf("pEACCES\n");
if(EROFS == errno)printf("pEROFS\n");
if(EFAULT == errno)printf("pEFAULT\n");
if(EINVAL == errno)printf("pEINVAL\n");
if(ENAMETOOLONG == errno)printf("pENAMETOOLONG\n");
if(ENOTDIR == errno)printf("pENOTDIR\n");
if(ENOMEM == errno)printf("pENOMEM\n");
if(ELOOP == errno)printf("pELOOP\n");
if(EIO == errno)printf("pEIO\n");
there's a neat standard function called "perror()"
this one may be worth a look too.
man 2 pipe
Bye.
Jasen
.
- References:
- open FIFO erro
- From: freegnu
- open FIFO erro
- Prev by Date: Re: mp3 playing library for C++
- Next by Date: Re: scope of linux in the corporates...
- Previous by thread: Re: open FIFO erro
- Next by thread: game monitor app
- Index(es):
Relevant Pages
|