Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.sao.ru/hq/sts/linux/book/c_marshall/subsubsection2_18_4_2_2.html
Дата изменения: Unknown
Дата индексирования: Sat Sep 11 20:52:07 2010
Кодировка:

Поисковые слова: interacting galaxies
<tt>pipe()</tt> - Low level Piping



Next: Interrupts and Signals Up: Piping in a C program Previous: popen() - Formatted Piping

pipe() - Low level Piping

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 .


Dave.Marshall@cm.cf.ac.uk
Wed Sep 14 10:06:31 BST 1994