[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
the sourcecode I wrote was just an example (sorry)
The fifo is created correctly
open the fd of the fifo
Furthermore my example code generates a deadlock - it should be:
fd=open("./FIFO",WRONLY|O_NONBLOCK) or "/tmp/FIFO" or whatever
the problem is not the open(...) - except that it returns even if it should
be blocked (NO O_NONBLOCK) - the trouble lies in the read(...) and
write(...) functions, which return with value -1. (an unknown errno is set)
but thanks for the fast answer ..
To: "Justin Flik" <email@example.com>
Subject: Re: FIFO
Date: Sun, 26 Nov 2000 14:00:55 +0100
Without having tested it, it looks like you should check the return
from mkfifo, open etc. to detect and print ny errors.
The root is read only so depending on where you run your program from
"./FIFO" might not be created, try "/tmp/FIFO" instead.
From: Justin Flik <firstname.lastname@example.org>
Date: den 25 november 2000 22:19
>I just writing a program in C++ at elinux. I need to communicate between
>processes and like to use FIFOs. The trouble is, that I get errors if I
>to read or write on it. (The same code is running on my PC with no
>Furthermore it seems that elinux ignores the blocking mechanism - this
>it returns the open-function even if it should not! open("FIFO",RDONLY)
>the same effect than open("FIFO",RDONLY|O_NONBLOCK) !? where noone else
>opens the same FIFO in write-mode.
>Could it be that FIFOs aren't implemented correctly in elinux yet? Or
>do something wrong in my code:
> fd=open("./FIFO",RDONLY); // should be wait till process
> read(fd,&ch,1); // TWO opens FIFO to write
> write(fd,"hello world",12);
>hope you can help me
>thanks in advance
>Get more from the Web. FREE MSN Explorer download :
>This Hotmail WebCourier newsletter has been sent to you from
>Get your own FREE subscription in a few easy steps.
>I do not have a Hotmail account:
>Choose this or any of our 60+ newsletters while registering for a free
>Hotmail e-mail account. http://www.hotmail.com
>I am a current Hotmail user:
>Sign in at http://www.hotmail.com, then click Free News in the left
>Check the box next to , then click OK.
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com