pipe function


pipe creates two file descriptors which can be used by parent and child processes to communicate data. A child process can be created with the fork function.



	Library:   unistd.h

	Prototype: int pipe(int fd[2]);

	Syntax:    int fd[2];
		   pipe(fd);


On error, pipe returns -1.

Once the pipe has been executed, the data can be transfered using read and write.


Notes:

Make sure that when you read exactly the same number of bytes that are written! I spend HOURS trying to figure out why I was loosing data because of this feature!!

Examples:

read and write fixed length records.

read and write variable length records.


See Also:

fork

popen function.

pclose function.

read function.

write function.


Top Master Index Keywords Functions


Martin Leslie