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

Propeller balance, PROPELLER BALANCE There are two types of balance of ...

PROPELLER BALANCE There are two types of balance of importance when working with propellers: • Static Balance • Dynamic Balance Static balance is checked and corrected

Pressure filter - aircraft maintenance , PRESSURE FILTER The pressure o...

PRESSURE FILTER The pressure oil filter housing contains a wire-wound or mesh, Paper or felt elements and incorporates a by-pass valve. The filter housing can be drained inde

Microbiology, Explain the following observations: cells of Escherichia coli...

Explain the following observations: cells of Escherichia coli fermenting glucose grow faster when NO3 - is supplied to the culture and then grow even faster when the culture is hig

Digit, Design the counters for the digital clock Minimum 100 words accepted...

Design the counters for the digital clock Minimum 100 words accepted#

#, • ''Discussed Since the promised return on Russian government debt is mu...

• ''Discussed Since the promised return on Russian government debt is much higher than the promised return on US government debt, you should invest your money in Russia

Project report, I need help for my project report plz. > Precast concrete p...

I need help for my project report plz. > Precast concrete panels manufactured in factory environments and rapidly cured using steam are being used for the walls of shallow foundati

Assignment, all about pepsi company symbol PEP 1. What is the name of the ...

all about pepsi company symbol PEP 1. What is the name of the company? What is the industry sector? 2. What are the operating risks of the company? 3. What is the financial risk

Depreciation Tax Calculation, Depreciation Calculation Two most popular me...

Depreciation Calculation Two most popular methods of charging depreciation are: straight line and diminishing balance or written-down value (WDV) methods. For reporting to the sha

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