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

Digital Desing Trough VHDL, force and release constructs represents wich as...

force and release constructs represents wich assignments

Cascaded, circit diagram and operation

circit diagram and operation

Engine cycles, ENGINE CYCLES The two commonly used cycles on which th...

ENGINE CYCLES The two commonly used cycles on which the I.C. engines operate are: 1Otto cycle.         2 Diesel cycle. 1 OTTO CYCLE: theoretical Otto cycle is shown i

Communications system, Communications System • Information Source - ...

Communications System • Information Source - Information may take many forms: data, image, voice, video • Transmittter - Processes information into a form suitable for

Case law on evaluatig credit requests, This case has been framed in order t...

This case has been framed in order to test the skills in evaluating a credit request and reaching a correct decision. Perluence International is large manufacturer of petroleum and

Flight control - characteristic equation, characteristic equation The c...

characteristic equation The characteristic equation (C.E.) corresponding to the linear state space equations comprising the state equation? x = Ax + Bu and output equatio

Process control, what is the input to a process control system?

what is the input to a process control system?

Electronics, what are basic think to select the bjt as switch

what are basic think to select the bjt as switch

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