Ok, so I'm supposed to Create a child process, send data to that child, have the child output the data, and wait on the child to finish.
Basically the parent process will read the data from the input file, and write it to the pipe.
The child process will read from the pipe, and write to the outputfile. Thing is I'm being provided with 3 classes. FileReader, FileWriter, and PipeMaker.
Here is my code: ``` std::list<EntryInfo> theList;
FileReader reader;
reader.readEntries(theList, Util::inputFilename, true);
FileWriter writer(theList);
writer.writeFile(Util::outputFilename);
pid_t pid;
PipeMaker(myPipe[2]);
pid = fork ();
if (pid < 0){/** fork failed. **/
fprintf (stderr, "Fork failed.\n");
exit(EXIT_FAILURE);
}else if (pid == 0){/** Child process. **/
PipeMaker close(myPipe[1]);
PipeMaker setUpToRead(myPipe[0]);
execl("./Part2_Template","W");
writer.writeFile(Util::outputFilename);
exit(EXIT_SUCCESS);
} else if(pid > 0){
/** Parent process. **/
PipeMaker close(myPipe[0]);
PipeMaker setUpToWrite(myPipe[1]);
writer.writeFile(setUpToWrite);
wait(NULL);
}``` Any help is appreciated, also I can provide the code for the 3 classes that I'm using if needed.