Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Show me the steps to solve You will need to implement the following functions: void exec _ cmd _ red _ out ( char *
Show me the steps to solve You will need to implement the following functions: void execcmdredoutchar args char filename Create a child process using fork. The child process should do the following: a Close standard output. b Create a new file with the name given by filename. c If the file can not be created, display an error and exit the child process. d Execute the command. e If the execution fails, display an error and exit the child process. The parent process should wait for the child process to complete. void execcmdredinchar args char filename Create a child process using fork. The child process should do the following: a Close standard input. b Open a file for reading only with the name given by filename. c If the file can not be opened, display an error and exit the child process. d Execute the command. e If the execution fails, display an error and exit the child process. The parent process should wait for the child process to complete. void execcmdpipechar args char args Create a child process using fork. The child process should do the following: a Create a pipe. b If the pipe creation fails, diplsay an error and exit the child process. c Create a second child process. d The second child process should redirect standard output to write to the pipe input, execute the command, and display an error and exit if execution fails. e The first child process should redirect standard input to read from the pipe output, execute the command, and display an error and exit if execution fails. The parent process should wait for the first child process to complete.
Show me the steps to solve You will need to implement the following functions:
void execcmdredoutchar args char filename
Create a child process using fork.
The child process should do the following:
a Close standard output.
b Create a new file with the name given by filename.
c If the file can not be created, display an error and exit the child process.
d Execute the command.
e If the execution fails, display an error and exit the child process.
The parent process should wait for the child process to complete.
void execcmdredinchar args char filename
Create a child process using fork.
The child process should do the following:
a Close standard input.
b Open a file for reading only with the name given by filename.
c If the file can not be opened, display an error and exit the child process.
d Execute the command.
e If the execution fails, display an error and exit the child process.
The parent process should wait for the child process to complete.
void execcmdpipechar args char args
Create a child process using fork.
The child process should do the following:
a Create a pipe.
b If the pipe creation fails, diplsay an error and exit the child process.
c Create a second child process.
d The second child process should redirect standard output to write to the pipe
input, execute the command, and display an error and exit if execution fails.
e The first child process should redirect standard input to read from the pipe
output, execute the command, and display an error and exit if execution fails.
The parent process should wait for the first child process to complete.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started