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

Ans fast, explain any 2 case tools in software engineering

explain any 2 case tools in software engineering

#, • ''Discussed Since the promised return on Russian government debt is mu...

• ''Discussed Since the promised return on Russian government debt is much higher than the promised return on US government debt, you should invest your money in Russia

Various stages of creep, Q. Explain various stages of creep? Ans. CREE...

Q. Explain various stages of creep? Ans. CREEP: Creep can be defined as the process by which plastic flow occurs when a constant stress or load is applied to a material for a

Hanning window, what is a procedure of solving the questions using hanning ...

what is a procedure of solving the questions using hanning window while designing a fir filter?

Jfet operation - junction, JFET OPERATION Figure shows the operati...

JFET OPERATION Figure shows the operation of a JFET. The JUGFET has a physical structure that can be represented by the diagram shown in Figure. In Figure, if the N-Ty

Npv of an mba, Create an excel spreadsheet estimating NPV of an MBA

Create an excel spreadsheet estimating NPV of an MBA

Architecture.., draw folded plate roof structure on multi purpose hall?

draw folded plate roof structure on multi purpose hall?

Career help, hey, i am doing b.e in chemical engineering but by aggregate i...

hey, i am doing b.e in chemical engineering but by aggregate is 55%. i would like to know what courses and preparation i have to do to get a good job. pls reply as soon as possible

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