I didn't have any prior experience in this. Need some guidance

The parent process should read an array (size 6) of double (frequency (1)) from the user and creates a pipe to do the inter-process communication and then creates a child process (Child-1). • Child-1 will calculate the velocity (V) when the wavelength (A) is 100 m (constant) and write answers to the pipe. Use the formula is given below, V = fa (V-Velocity, /-frequency, wavelength) Then the Child-1 creates a new child process (Child-2) and the Child 2 should read values from the pipe and print them to the screen
If you can start the processes from the shell, then you can type:
./process1 | ./process2 | ./process3

This will simply start the three processes and send the stdout of process #1 to the stdin of process #2, as well as the stdout of process #2 to the stdin of process #3, by using a total of two pipes.

Within a certain process, you read from its stdin with scanf() and write to its stdout with printf().

If you really need to start the sub-processes and connect the pipes directly from C code, then you'll probably want to have a look at the popen() function: https://linux.die.net/man/3/popen

...or you could use the poor man's "solution":
system("./process1 | ./process2 | ./process3"); /* wrap shell command in C code */
Last edited on
Topic archived. No new replies allowed.