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

#title urban and regional planning.., name and elaborate the decision probl...

name and elaborate the decision problems in urban and regional planning?

Providing fire resistant - fire safety management, Providing fire resistant...

Providing fire resistant: If the building does not provide everyone with alternative exit routes then it may be acceptable for people to pass the fire if they are separated f

Urban stormwater, Is there anyone on your staff good with HEC-HMS software ...

Is there anyone on your staff good with HEC-HMS software for modeling rain events?

Engineering mechanics questions, I need help in engineering mechanics quest...

I need help in engineering mechanics questions? Do you provide homework help, Please let us know how do i get it quich time...

Mobile Communication, A car, moving in the south-east direction at a veloci...

A car, moving in the south-east direction at a velocity of 5 m/s, receives a ray of power of -120 dBm each from the north, east and west. The carrier frequency is 300 MHz. (i) Sket

Probability distribution in matlab, I would like to ask in detail. How can ...

I would like to ask in detail. How can I attach the files?

Process of fire risk assessment in uk, Process of fire risk assessment: ...

Process of fire risk assessment: In the UK, the process for  the FRA came out of the process for a general risk assessment. In a general risk assessment hazards are identif

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