[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FIFO



Without having tested it, it looks like you should check the return values
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.

/Johan

-----Original Message-----
From: Justin Flik <justin_flik@xxxxxxx.com>
To: dev-etrax@xxxxxxx.com>
Date: den 25 november 2000 22:19
Subject: FIFO


>Hi there!
>
>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 try
>to read or write on it. (The same code is running on my PC with no
>problems).
>Furthermore it seems that elinux ignores the blocking mechanism - this
means
>it returns the open-function even if it should not! open("FIFO",RDONLY) has
>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 did i
>do something wrong in my code:
>
>process ONE:
> mkfifo("./FIFO",S_IRUSR|S_IWUSR);
> fd=open("./FIFO",RDONLY); // should be wait till process
> read(fd,&ch,1);   // TWO opens FIFO to write
> close(fd);
>
>process TWO:
> fd=open("./FIFO",WRONLY);
> write(fd,"hello world",12);
> close(fd);
>
>hope you can help me
>thanks in advance
>
> JF
>
>___________________________________________________________________________
__________
>Get more from the Web.  FREE MSN Explorer download :
http://explorer.msn.com
>
>This Hotmail WebCourier newsletter has been sent to you from
>justin_flik@xxxxxxx.
>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 menu.
>Check the box next to , then click OK.
>
>