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

#Corporate Finance Homework, #As an investment advisor you have been approa...

#As an investment advisor you have been approached by a client called Ramesh, who wants some help in investment related matters. Ramesh is currently 45 years old and has Rs 6, 00,

Market value, Calculate the market value of a firm with total assests of $1...

Calculate the market value of a firm with total assests of $105 million and $50 million of 10% perpetual debt in the capital structure. The firm''s cost of equity is 14% on the $55

Interview Technique, Explain interview technique in software engineering in...

Explain interview technique in software engineering in brief?

Polymorphism, Q.  Define the polymorphism. Ans. POLYMORPHISM: It is d...

Q.  Define the polymorphism. Ans. POLYMORPHISM: It is defined as the change in atomic structure which occurs at a definite transformation temperature. The cooling diagram of

#title: Signal Processing, how to load a large file consisting hex bytes wi...

how to load a large file consisting hex bytes without spaces and plot the required bytes

Marginal costing, VK Ltd a multi-product Company, furnishes you the followi...

VK Ltd a multi-product Company, furnishes you the following data relating to theyear 2000.First Half of the year Second Half of the yearSales Rs. 45,000 Rs. 50,000 Total Cost Rs. 4

Capital budgeting, what things require for finance project on capital budge...

what things require for finance project on capital budgeting?

Logic gate - nand gate, NAND Gate; When constructing a NAND gate using ...

NAND Gate; When constructing a NAND gate using transistors as the switching devices, the output often represents the 'inversion' of the "AND" gate. Figure 4 shows an example o

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