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

Technical drawing, career aspiration as a determinant to senior secondary ...

career aspiration as a determinant to senior secondary school students performance in Technical drawing.

Heat transfer, A 2-m long section of a 3-mm in diamter wire is maintained a...

A 2-m long section of a 3-mm in diamter wire is maintained at a constant surface temperature of 370C. The wire is subject to a cross-flow of air at 30C at 6 m/s Determine the rate

Liquidity ratios, Liquidity Ratios: The liquidity ratios of the company hel...

Liquidity Ratios: The liquidity ratios of the company help in determining the ability of the company to convert its current or liquid assets readily into cash. Higher the ratios be

Pneumatics, 3. Design and draw a circuit using the cascade system to operat...

3. Design and draw a circuit using the cascade system to operate two cylinders (A and B) which, on the operation of a start valve, produces the sequence A – B + B – A+. The cylinde

Jfet operation - junction, JFET OPERATION Figure shows the operati...

JFET OPERATION Figure shows the operation of a JFET. The JUGFET has a physical structure that can be represented by the diagram shown in Figure. In Figure, if the N-Ty

DBMS, why we study r architecture?

why we study r architecture?

Android, need help correcting an error on running the developed app it doe...

need help correcting an error on running the developed app it doesnt show the fetched output from internet ?

Base case NPV analysis , How base case NPV analysis is applied in financial...

How base case NPV analysis is applied in financial risk management

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