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

Finite Element Analysis Assignment, Need help using FEA/FEM software (MSC M...

Need help using FEA/FEM software (MSC Marc/Mentat) to model and analyze a system,then write a lab report about it, it is due tomorrow... anything you can do for me?

Decision table software engineering, Write a decision table that specifies ...

Write a decision table that specifies the rules for the game of checkers.

representing vectors in different axes, Representing vectors in different ...

Representing vectors in different axes All positions, velocities, momentums and accelerations are really relative positions, relative velocities, relative momentums and relativ

Financial managment, what is the consideration of time importance in financ...

what is the consideration of time importance in financial management? how can time time be adjust illustrate you?

Difference between elastic and plastic deformation, Q. State difference bet...

Q. State difference between elastic and plastic deformation. Ans. Elastic deformation: Elastic deformation is that the part of the deformed material, when the applied load is

Sprinkler installations in high rise buildings, Sprinkler installations in ...

Sprinkler installations in High rise buildings: The staircases in high rise buildings need extra protection against fire.  It can take a long time for everyone to descend the

Flash in forging, Q. Explain the following terms.             ...

Q. Explain the following terms.             (i) Flash in forging.            (ii) Fullering and up setting in forging.            (iii) Trimming of

Chaplets, Q. Explain the Chaplets.                                    ...

Q. Explain the Chaplets.                                                       OR  When are chaplets required in moulding practice? What is the material of the chaplets?

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