Re: using pipe
- From: loic-dev@xxxxxxx
- Date: 25 Oct 2006 03:37:21 -0700
Hello,
I wanted to know if the "pipe" can only be used for data transmission from one process
to another (parent to child and viceversa) ?
Yes, pipe can be used as Inter-Process Communication (IPC) between
related processes.
Can a pipe be used to transfer data in the same prcoess ?
This could done, albeit this can be tricky.
For instance, I want to execute some function and want to save its
output to a pipe then in the same process, I need to read the output from this
pipe to some buffer (one string at a time). Can this be done ?
I beg your pardon. But why not using directly a buffer for that? The
function write its output to the buffer, and other functions may
retrieve the data from that buffer afterwards. That would be
definitively easier and more efficient than using a pipe.
Could you express the reasons behind that "pipe" choice?
Also, man page says that pipe returns two file descriptors ( and not
the FILE poiters to stream FILE *). How can I use fgets() to read the data
from the pipe ?
man 3 fdopen
Cheers,
Loic.
.
- Follow-Ups:
- Re: using pipe
- From: junky_fellow@xxxxxxxxxxx
- Re: using pipe
- References:
- using pipe
- From: junky_fellow@xxxxxxxxxxx
- using pipe
- Prev by Date: fread
- Next by Date: Re: fread
- Previous by thread: using pipe
- Next by thread: Re: using pipe
- Index(es):
Relevant Pages
|
|