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

Evaporation, 2-17 Given a wind speed of 5.0 m/s at 2 m above the ground and...

2-17 Given a wind speed of 5.0 m/s at 2 m above the ground and a roughness length of 0.8 cm, compute (a) the friction velocity, in centimeters per second, and (b) the wind speed, i

Shift registers, Shift registers A register is a number of flip-flops a...

Shift registers A register is a number of flip-flops arranged in a circuit used for storing data.  A shift register is one that is designed to move the data along the register.

Interlaminar shear strength , Composites have low shear strengths compared ...

Composites have low shear strengths compared to longitudinal strengths. The ILSS test is a simple 3 point bend test, requiring a small amount of material. A span to depth ratio

Case Let, This case has been framed in order to test the skills in evaluati...

This case has been framed in order to test the skills in evaluating a credit request and reaching a correct decision. Perluence International is large manufacturer of petroleum and

. CFD, HOW TO MAKE ROTATING FRAME

HOW TO MAKE ROTATING FRAME

Cro probes, #questiodescribe different types of cro probes

#questiodescribe different types of cro probes

Semiconductor basics summary, N-type (for example add Antimony) The are...

N-type (for example add Antimony) The are materials which have Pentavalent impurity atoms (Donors) added and conduct by the "electron" movement and are called as N-type Semi

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