LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   messing with a FIFO (https://www.linuxquestions.org/questions/linux-software-2/messing-with-a-fifo-657948/)

leedude 07-24-2008 07:51 AM

messing with a FIFO
 
hi, i need to use interprocess communication, and have done a little reading.
it seems i need a FIFO file.
as i understand it, if a process tries to read from an empty FIFO, the process is halted until another process writes something to it.

likewise, if a process tries to write to a full FIFO, it is halted until another process reads from it.

so heres what i did:

i open a terminal and type:
Code:

mkfifo fifo
cat fifo

like i predicted, cat seems paused.

i then open another terminal and run:
Code:

echo text > fifo
this command runs, but cat still remains halted in the other terminal.
i thought that cat would spit out the new 'text'.

have i got the wrong idea about something?

leedude 07-24-2008 08:04 AM

oops, a typo on my part.
i was using echo 1 > fifotest


All times are GMT -5. The time now is 07:58 PM.