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

Caselet- 2, suggestion regarding credit limit. should it be approved or not...

suggestion regarding credit limit. should it be approved or not what should be the amount of

Direct from engine compressor, Direct from engine compressor: A Load va...

Direct from engine compressor: A Load valve is switched on from the flightdeck, power for the switch is available once the APU has achieved 95% + 3 sec. This energises the swit

Zeroth law of thermodymanics, Explain with the aid of sketch of zeroth law ...

Explain with the aid of sketch of zeroth law of thermodynamics

Mass Balances, Engineers sometimes add chlorine to pipes to disinfect water...

Engineers sometimes add chlorine to pipes to disinfect water. It is desired to achieve four logs of kill. This means that the effluent concentration of microoganisms is 10^-4 times

What is ebidta?, What Is EBIDTA?  EBITDA appears for income before atten...

What Is EBIDTA?  EBITDA appears for income before attention, taxation, devaluation, and amount. EBITDA came into large use among personal investment companies, seeking to determ

Econometrics coursework, Hello this is Lee, I have an Econometrics coursewo...

Hello this is Lee, I have an Econometrics coursework to be helped by some experts from your company. Please send me your reply asap Lee

Thin-film ic, THIN-FILM IC: Unlike the monolithic IC's, which are forme...

THIN-FILM IC: Unlike the monolithic IC's, which are formed within a semiconductor material (substrate), the thin-film circuit is formed on the surface of an insulating substrat

Java , why we need EJB

why we need EJB

Flight dynamics - velocity component, Force, Moment, Velocity and Angular V...

Force, Moment, Velocity and Angular Velocity Components • Aerodynamic Force Components - X, Y, Z • Velocity Components - U, V, W (or Vx, Vy, Vx) • Angular Velocity Components - P,

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