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

Budget and determining, In Corporate finance, Experts engaged in this occup...

In Corporate finance, Experts engaged in this occupation have the liability to increase the organization's revenue, shareholder's money, investment spending budget and determining

Fire precautions - fire protection engineering, Fire precautions - fire pro...

Fire precautions - fire protection engineering: Fire precautions include: Protecting escape routes in fire resisting construction, Providing fire doors between

Welding, what is causes of submage arc welding

what is causes of submage arc welding

Imaging infrared seekers , Imaging Infrared Seekers  A more common appr...

Imaging Infrared Seekers  A more common approach is to use an infrared waveband where there is a large amount of ambient light from the thermal emission of the background. Th

Strength of materials, a rectangular beam of size 40mm*60mm is subjected to...

a rectangular beam of size 40mm*60mm is subjected to bending. the maximum bending stress is limited to 75N/mm^2. find the moment of resistance of beam section.

Derive, derive the power in case of r-l circuit

derive the power in case of r-l circuit

Trusses, Analysis of truste,2D truss analysis using method of joint(cantile...

Analysis of truste,2D truss analysis using method of joint(cantilever & simply support)?

International finance, What will be the effects of an increase in the money...

What will be the effects of an increase in the money supply on the interest rate? What will be the effects of an increase in real output on the interest rate?

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