Good morning;

I am trying to make a program which creates two child process which run in parallel. Child one is reading a text file while child 2 is reading another text file and they both write to a binary file which is read by the parent. Currently my program looks something like this:

int main (int argv, char **argc) {

open files

if ((child1 = fork()) == 0)
.
.
function call to read from file
.
.
else return child1;

if ((child2 = fork()) == 0)
.
.
function call to read from file
.
.
else return child 2;

I'm not quite sure I understand how these child processes work. I know about the parent-child ids but I fail to see how you can get two children running at the same time.

Furthermore, I want the children to communicate with the parent when a certain substring is found and have that parent read the binary file.

Cheers.