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

Engine vibration indication, Engine Vibration Indication The engine vib...

Engine Vibration Indication The engine vibration monitoring (EVM) system shows the out of balance force for the N1 and N2 shaft. High engine vibration shows engine damage or

Pressure filter - aircraft maintenance , PRESSURE FILTER The pressure o...

PRESSURE FILTER The pressure oil filter housing contains a wire-wound or mesh, Paper or felt elements and incorporates a by-pass valve. The filter housing can be drained inde

Math modelling, As an engineering student, the ministry of energy and miner...

As an engineering student, the ministry of energy and minerals has tasked you to help them model equation(s) that can estimate the amount of crude oil in a reservoir. The governmen

Guidance control system, Guidance Control system The control aspect...

Guidance Control system The control aspect of the guidance system is intended to stabilise the behaviour of the airframe.  The fact that the guidance system will always h

Chemical engineering, i got an assignment on chemical engineering reactions...

i got an assignment on chemical engineering reactions

Blade twist - aircraft engine, BLADE TWIST: Rotational velocity and its...

BLADE TWIST: Rotational velocity and its effect on the Angle of Attack depends on the radius of the blade element in question. A blade element near the blade root (hub) will h

#magnetic circuit, an iron ring with amean dia of 50 cm has an air gap of 1...

an iron ring with amean dia of 50 cm has an air gap of 1mm awinding of 200 turns if the permeability of the iron is 400 when a circuit of 1.25A flows through the coil find the flux

Assignment , I want help for the circuit theory

I want help for the circuit theory

Signal conditioning amplifier, Signal conditioning amplifier The primar...

Signal conditioning amplifier The primary function of the signal conditioning amplifier is to match the output signal range of the transducer to the input signal range of the a

Audio and video system, why front porch and back porch interval is providin...

why front porch and back porch interval is providing before and after the horizontal simpluses

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