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

Computational aerodynamics-guided reading, It is recommended that if possib...

It is recommended that if possible you should buy a copy of this book. It will prove useful for the new fourth year configurational aerodynamics module also. Blackwells bookshop ha

Telecom engg, the project those see in the matlab project which in the voic...

the project those see in the matlab project which in the voice of different birds

Signal and system, if the response of a signal is h(t) then the cascading o...

if the response of a signal is h(t) then the cascading of two responses h1(t) and h2(t) is given by

Torsional divergence, Torsional Divergence Lets first try to explain a...

Torsional Divergence Lets first try to explain and interpret torsional divergence for the aerofoil structural model physically. An additional figure describing the mechanical s

Crystal structure, how can we determine the crystal structure of material b...

how can we determine the crystal structure of material by having interplanar spacing d?

Students industrial work experience, Where are the recomended areas or indu...

Where are the recomended areas or industries where an Agricultural Engineering Student can apply for industrial training?

FSE, A W12x40 beam is heated to 760°C. Answer the following questions. Wh...

A W12x40 beam is heated to 760°C. Answer the following questions. What is the W/D factor for sprayed protection? What is the W/D factor for box type protection? What is the spe

Fire safety management for clubs, Fire safety management for clubs: In...

Fire safety management for clubs: In clubs and other places where there is music being played, or other entertainment, it is important that the music (or other entertainment)

Aerofoil aerodynamics -framework, Framework In the laboratory we will de...

Framework In the laboratory we will deal with low speed flows, at first using the potential flow solver. We will also investigate behaviour for the NACA 4-series of aerofoils.

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