Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://jet.sao.ru/hq/sts/linux/book/c_marshall/subsubsection2_18_4_2_2.html
Дата изменения: Unknown Дата индексирования: Tue Oct 2 09:33:01 2012 Кодировка: Поисковые слова: meteor shower |
int pipe(int fd[2]) - creates a pipe and returns two file descriptors, fd[0], fd[1]. fd[0] is opened for reading, fd[1] for writing.
pipe() returns 0 on success, -1 on failure and sets errno accordingly.
The standard programming model is that after the pipe has been set up, two (or more) cooperative processes will be created by a fork and data will be passed using read() and write().
Pipes opened with pipe() should be closed with close(int fd).
Example: Parent writes to a child
An example of piping in a C program is plot.c and subroutines and is
detailed in Appendix .