The prolems are 2.
1) the lack of the ! into the (pid1=fork())
2) the lack of a wait or waitpid function after the else.
The output of your program is correct, but sometimes the first output line is wrote on the shell line, and
always the program waits an enter to terminate.
I have tested your code with a Linux Mandrake 8.2 .
Hi!!
I have a problem reading from a fifo pipe in shell script.
The idea is simple, I have a C program with two pipe files:
An input pipe I use to send commands in shell script to the C program (echo "command" > input.pipe)
An output pipe that I read the result of the command also in... (4 Replies)
Hi,
Program A: uses pipe()
I am able to read the stdout of PROGAM B (stdout got through system() command) into PROGRAM A using:
* child
-> dup2(fd, STDOUT_FILENO);
-> execl("/path/PROGRAM B", "PROGRAM B", NULL);
* parent
-> char line;
-> read(fd, line, 100);
Question:... (2 Replies)
Dear unix gurus,
I have a data file with header information about a subject and also 3 columns of n rows of data on various items he owns. The data file looks something like this:
adam peter
blah blah blah
blah blah blah
car
01 30 200
02 31 400
03 57 121
.. .. ..
.. .. ..
n y... (8 Replies)
Hi
This is a exercise question from Unix network programming vol2.
Why the SIGPIPE signal is generated only for writers when readers disappear.
why not it is generated for readers when writer disappears.
I guess, if the writer didn't get any response like the reader gets EOF,
it will... (4 Replies)
Hi guys.
1. how much is the size of pipe?(i mean the buffer size)
2. is this size different in various UNIX derivations?
3. what happens if we write to a full pipe? does it block until get some free space(the other side receive data) or returns an error?
3. FIFO s are physical files on the... (2 Replies)
I'm trying to read a fifo using awk and comming across some problems. I'm writing to the fifo from multiple processes invoked by GNU Parallel:
mkfifo my_fifo
awk '{ a = a + $2 } END { for (i in a) print i, a }' my_fifo | sort -nk1 > sorted_output
grep -v '^@' massive_file | parallel... (3 Replies)
Hi,
I have a little knowledge about mkfifo, first-in-first-out, a special file, a named pipe and it involves inter-process communication,
as multiple processes can write data into a single file.
Here, I would like to know how this is helpful in executing the below Oracle 'imp' command... (1 Reply)
I have created a fifo named pipe in solaris, which writes the content of a file, line by line, into pipe as below:
$ mkfifo namepipe
$ cat books.txt
"how to write unix code"
"how to write oracle code"
$ cat books.txt >> namepipe &
I have a readpipe.sh script which reads the named... (2 Replies)
Discussion started by: naveen mani
2 Replies
LEARN ABOUT X11R4
fifo
fifo(3tcl)fifo(3tcl)NAME
fifo - Create and manipulate u-turn fifo channels
SYNOPSIS
package require Tcl
package require memchan
fifo
DESCRIPTION
fifo creates a stream-oriented in-memory channel and returns its handle. There is no restriction on the ultimate size of the channel, it
will always grow as much as is necessary to accommodate the data written into it.
In contrast to the channels generated by memchan a channel created here effectively represents an U-turn. All data written into it
can be read out, but only in the same order. This also means that a fifo channel is not seekable.
The channels created here can be transferred between interpreters in the same thread and between threads, but only as a whole. It is
not possible to use them to create a bi- or unidirectional connection between two interpreters.
Memory channels created by fifo provide two read-only options which can be queried via the standard fconfigure command. These are
-length
The value of this option is the number of bytes currently stored in the queried memory channel.
-allocated
The value of this option is the number of bytes currently allocated by the queried memory channel. This number is at least as big as
the value of -length.
As the channels generated by fifo grow as necessary they are always writable. This means that a writable fileevent-handler will fire con-
tinuously.
The channels are also readable if they contain more than zero bytes. Under this conditions a readable fileevent-handler will fire continu-
ously.
NOTES
One possible application of memory channels created by memchan or fifo is as temporary storage device to collect data coming in over a pipe
or a socket. If part of the processing of the incoming data is to read and process header bytes or similar fifo are easier to use as they
do not require seeking back and forth to switch between the assimilation of headers at the beginning and writing new data at the end.
SEE ALSO
fifo2, memchan, null
KEYWORDS
channel, fifo, i/o, in-memory channel, memchan, stream
COPYRIGHT
Copyright (c) 1996-2003 Andreas Kupries <andreas_kupries@users.sourceforge.net>
Memory channels 2.1 fifo(3tcl)