i have assignment and i cant solve it can any one help me plz??
Create a text file (commands.txt) and store the following commands in that file.
ls –l
ps
who
Write a C/C++ program that does the following:
Creates a pipe and forks and child process.
The parent process reads each command from the commands.txt and passes the command to the child process (one command at a time) using a pipe. The child process reads each command from the pipe and executes the commands. The command and the output of each command are saved in a file output.txt. Note that the child process should written in such a way that it can execute as many commands as sent to it by the parent process (it should not be only for 3 commands, assume the child process does not know the number of commands to be sent to it by the parent process).
The parent process then prints the output of all the commands from output.txt after removing the commands and inserting two blank lines before the output of each command. .
The file output.txt is then removed.