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()

Flow at low mach number and zero incidence about m6 wing, Flow at low Mach ...

Flow at low Mach number and zero incidence about M6 wing Results from FP were obtained corresponding to M ∞ = 0.2 and a = 0 and, as noted, with the input files generated by FP

Summing amplifier, Summing amplifier: As the title implies, this is an ...

Summing amplifier: As the title implies, this is an adding device.  The circuit can take any number of voltage inputs, and the output voltage is simply the sum of these inputs.

Class number arrangement - library management, Class Number Arrangement   ...

Class Number Arrangement   Unlike the Cities Numbers of Dewey Decimal Classification the Colon Class Numbers have not only Arabic Numerals but also capital letters of the Roman

Derivative Securities, Let C(K) denote a European vanilla Call option with ...

Let C(K) denote a European vanilla Call option with strike price K. Assume that all options are identical except for strike price, and strike prices satisfy (K1) What are the no-

Flames obtained in an oxyacetylene gas welding process, Q.  Describe the t...

Q.  Describe the types of flames obtained in an oxyacetylene gas welding process giving the applications. There are three types of flames in the gas welding on the base of the

Restoration of clipped speech signal, Restoration of clipped speech signal ...

Restoration of clipped speech signal using linear prediction

CDMA, In a CDMA system, the signal is spread over a large bandwi...

In a CDMA system, the signal is spread over a large bandwidth by multiplying the transmitted symbol by a sequence of short pulses, also called chips. The

Memory card functiOn, How does small memory card can read all photos and vi...

How does small memory card can read all photos and videos and saves by using what?

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