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

P d c, what are clippers

what are clippers

Matlab, The 3 sum problem: (20 pts.) Provided a 1D array of integers, find ...

The 3 sum problem: (20 pts.) Provided a 1D array of integers, find all combinations of 3 values from this set such that: a+b+c=0 For example, if one were provided with the set [3 1

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

KK-3 system coding, how to write code for any particle shape using KK-3 sys...

how to write code for any particle shape using KK-3 system coding in grope technology

Engine, #question.what if i poured diesel in petrol engine and petrol in di...

#question.what if i poured diesel in petrol engine and petrol in diesel engine.

Aerodynamics, what is centrifugal twisting moment

what is centrifugal twisting moment

Financial econometrics, #question.do you write financial econometrics assig...

#question.do you write financial econometrics assignment?.

Removing aircraft engines, Removing Aircraft Engines: To prepare an air...

Removing Aircraft Engines: To prepare an aircraft for engine removal, check that the aircraft weight and balance will not be adversely effected when the engine is removed. Mos

Aggregate properties - voids ratio and bulk density, Aggregate properties ...

Aggregate properties 1.Aim: To compare the bulk density, voids ratio and angularity number of a nominal single sized aggregate when subjected to different levels of compaction

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