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

Define the term technology, Question 1 Define the term technology. Write a...

Question 1 Define the term technology. Write a effective short note on evolution and growth of technology Question 2 Citing an example, state and explain the reasons that com

Flight dynamics - velocity component, Force, Moment, Velocity and Angular V...

Force, Moment, Velocity and Angular Velocity Components • Aerodynamic Force Components - X, Y, Z • Velocity Components - U, V, W (or Vx, Vy, Vx) • Angular Velocity Components - P,

Various characteristics of metal powders, Q. Describe the various character...

Q. Describe the various characteristics of metal powders to be considered before their selection for any process. Ans. Metal Powder Characteristics          Both t

Matlab coding, create 22 elements in scalar hint:for loop or any loop state...

create 22 elements in scalar hint:for loop or any loop statement and append to previous variable element by elements

The integrator, Integrator This circuit performs the calculus operation...

Integrator This circuit performs the calculus operation of integration. An operational amplifier with negative feedback applied via a capacitor (instead of a resistor) will pe

Water traetment, what are the different phosphates used in water treatment?...

what are the different phosphates used in water treatment?

Depreciation Tax Calculation, Depreciation Calculation Two most popular me...

Depreciation Calculation Two most popular methods of charging depreciation are: straight line and diminishing balance or written-down value (WDV) methods. For reporting to the sha

FISICA, EL DESPLAZAMEINTO DE UNA PARTICULA ESTA DADO POR S=(-2+3T)e¨-0.5t

EL DESPLAZAMEINTO DE UNA PARTICULA ESTA DADO POR S=(-2+3T)e¨-0.5t

Demand schedual, How do I create a demand schedual for 1 year?

How do I create a demand schedual for 1 year?

Enhancing finance revenue.., Enhancing finance revenue In Corporate Fin...

Enhancing finance revenue In Corporate Finance and Business financial is the area of financial that promotion with financial options of organizations. Its main objective is to

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