C programming fork() dub2(), Other Engineering

Assignment Help:
develop a C program for Linux called pipes.c that does the following:
In the main() function, it creates a pipe using the pipe() function, then creates two child processes with fork(). Child 1 redirects stdout to the write end of the pipe and then executes with execlp() the "ls -al" command. Child 2 redirects its input from stdin to the read end of the pipe, then it executes the "sort -n -k 5" command.
After creating both children, the parent process waits for them to terminate before it can exit.
Note that you may have to create Child 2 first, followed by Child 1.

The parent program does the same thing as a shell that runs the command "ls -al | sort -r -n -k 5".

You must use the fork(), pipe(), dup2(), close(), execlp() functions (or other exec() variation).

Related Discussions:- C programming fork() dub2()

Math problems solutions matlab, Matlab is a 4th technology selection langua...

Matlab is a 4th technology selection language, which is designed by The MathWorks. It provides an exact processing atmosphere. Matlab works a variety of math features like design o

Survey, what are the obstacles which are likely to encounter chain survey a...

what are the obstacles which are likely to encounter chain survey and how to overcome them.

EMI, explain ramp type

explain ramp type

Compressor characteristics, Compressor characteristics: When a compress...

Compressor characteristics: When a compressor is designed it is essential to establish the points at which it is likely to surge. Tests are carried out to determine the relati

Automatic interior car lights control, hi there, i need to know if its poss...

hi there, i need to know if its possible to create a circuit of automatic interior car lights control

Hysteresis, hysteresis loss least epends on

hysteresis loss least epends on

#pareto, how to crate pareto charts eith matlab?

how to crate pareto charts eith matlab?

Changes in temperature and pressure-aircraft maintenance, Changes in temper...

Changes in temperature and pressure: The changes in temperature and pressure of the gases through a gas turbine engine are illustrated in Figure 1.5 The efficiency with which t

Totipotency, Why do only plant cell have totipotency?

Why do only plant cell have totipotency?

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd