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

Cash Conversion Cycle, The need for working capital to run the day-to-day b...

The need for working capital to run the day-to-day business activities cannot be overemphasized. We will hardly find a business firm which does not require any amount of working ca

Ignition systems in aircraft engine, IGNITION SYSTEMS The outline of a ...

IGNITION SYSTEMS The outline of a high energy ignition system is illustrated in the figure. Each high energy ignition unit has a low voltage supply which is controlled by the

Java , why we need EJB

why we need EJB

Hot and cold working, advantages and disadvantages of cold and hot working

advantages and disadvantages of cold and hot working

Couplings in engine, Couplings: Because of the requirement to make main...

Couplings: Because of the requirement to make maintenance tasks such as engine removal/refit, gearbox removal/refit easier, it is necessary to have a means of coupling the turb

Terrestrial telescope., how to making terrestrial tele scope an how its wor...

how to making terrestrial tele scope an how its work and formulation of terrestrial telescope

Fins vs canards , Fins vs Canards  Canard control - Good lift/latax co...

Fins vs Canards  Canard control - Good lift/latax control for moderate angles of attack. - Shed vortices can interfere with tail to generate roll moment. - Tendency to stall

Engineering Management, what is the best Master thesis that can be done i...

what is the best Master thesis that can be done in this major ?I need suggestions regards

Lifting wing, Lifting wing FP was run at the conditions corresponding t...

Lifting wing FP was run at the conditions corresponding to AGARD WG07 TEST CASE 11, namely M∞ = 0.84,α= 3.06 deg. The ‘final step' values of the partially-conservative paramete

Explain the instruction format of an assembler, Question 1 What is a compu...

Question 1 What is a computer? Explain the block diagram of a general purpose digital computer Question 2 Explain the instruction format of an assembler Question 3

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