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

Restoration of clipped speech signal, Restoration of clipped speech signal ...

Restoration of clipped speech signal using linear prediction

Speed control in aircraft engine, Speed control in Aircraft Engine: Bec...

Speed control in Aircraft Engine: Because the APU is designed to run at a constant rpm, some means must be provided to control this speed. Such a control device is known as a

Flight dynamics - introduction, In the Aircraft Performance course, the air...

In the Aircraft Performance course, the aircraft was assumed to be in a steady-state (e.g. steady  cruise, climb, turn, glide), with the forces and moments balanced. The subject of

Theory of solar system, Expertsmind.com brings you unique solution in ele...

Expertsmind.com brings you unique solution in electrical engineering Define terms of Galaxy Clusters, Basic Astronomical Objects, Astronomical Distance Units, Terms

Area and voume by contour, what do you know about area and volume by contou...

what do you know about area and volume by contour?explain

Auto cad, Do you provide help with Autocad assignments?

Do you provide help with Autocad assignments?

Engineering economic analysis definition, Introduction Engineering Econ...

Introduction Engineering Economic Analysis Definition: using a combination of quantitative and qualitative techniques to analyze economic differences among engineering design a

Embossing and coining, Embossing is a forming operation used to create inde...

Embossing is a forming operation used to create indentation in the sheet, such as raised (indented) lettering or strengthening rips, as shown in fig. Some stretching and thinning o

Function intersect - set operations, Function intersect - set operations: ...

Function intersect - set operations: The function intersect returns, additionally to the vector having the values in the intersection of v1 and v2, an index vector into v1 and

TANGENT GALVANOMETER, WHY THE NEEDLE OF TANGENT GALVANOMETER DEFLECT WITH I...

WHY THE NEEDLE OF TANGENT GALVANOMETER DEFLECT WITH INCREASING OR DECREASING CURRENT?

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