• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

C++ Piping

QurazyQuisp

Platinum Member
Feb 5, 2003
2,554
0
76
So, I'm right a program that will basically take a text file and pipe it to a process (Only a small part of the program). I using both fork() and pipe() so I have a parent & child process, and pipes between them. However, I'm not sure how to actually "give" the information (text) to the child process. I've tried using write() to send it, and it seems to writing correctly, however it doesn't seem as if the process is receiving it.

I've been tipped by a friend to use dup/dup2 however I'm not sure exactly what they do. The man pages don't seem like much help.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,698
4,660
75
My old Operating Systems book gives an example with just read() and write() and fork(). This site has several such examples.