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

Torque indication - aircraft engine, Torque indication: Turboprop and t...

Torque indication: Turboprop and turboshaft engines do not provide significant thrust through their jet pipes, so EPR would not be of any use in determining the thrust being pr

CRO, different types of switches used in CRO

different types of switches used in CRO

Inspection checklist, Inspection Checklist: The following checklist is...

Inspection Checklist: The following checklist is a starting point and it may be added to if subsequent inspections and debriefs indicate that this would be beneficial.   It sh

Hardness of water, why is only 1 lime and sod required for aluminium impuri...

why is only 1 lime and sod required for aluminium impurities

#title.MARKET VALUE WEIGHT OF EQUITY., AAA has 1,000,000 shares of common s...

AAA has 1,000,000 shares of common stock trading at $20.00 per share. The company''s debt consists of 2,000 $1,000 par value 10-year 7.0% annual coupon bonds with semiannual paymen

Application of Mechatronics Engineering, This is an individual task in the ...

This is an individual task in the form of an essay of between 900 and 1300 words. Illustrative material such as pictures may be included in addition to the text.

Ticket EM134795S38_1, Do you receive my payment $480 for the Ticket EM13479...

Do you receive my payment $480 for the Ticket EM134795S38_1 today Feb 20/2017? Please inform me to know. My Email is: Thank you

Marginal costing, VK Ltd a multi-product Company, furnishes you the followi...

VK Ltd a multi-product Company, furnishes you the following data relating to theyear 2000.First Half of the year Second Half of the yearSales Rs. 45,000 Rs. 50,000 Total Cost Rs. 4

Mvar structural time series model, I need the code for a multivariate struc...

I need the code for a multivariate structural time series model with multiple cyclical components - any language is good.

Degeneracy , If a single energy eigen value corresponds to more than one ei...

If a single energy eigen value corresponds to more than one eigen function then degeneracy is said to be exist and the number of wave function associated with a single value of ene

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