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

Numeric computation matlab, Expertsmind.com offers Performing Numeric Comp...

Expertsmind.com offers Performing Numeric Computation matlab assignment help MATLAB contains numbers, precise, and technological innovation features to support all common tech

Comparison of fp result with experiment, Comparison of FP result with exper...

Comparison of FP result with experiment At the lowest test lift coefficient the flow is just subcritical (in the sense that the Mach number of the flow component normal to the

Ans fast, explain any 2 case tools in software engineering

explain any 2 case tools in software engineering

Transistor configurations, TRANSISTOR CONFIGURATIONS: Before a transist...

TRANSISTOR CONFIGURATIONS: Before a transistor can be used, it must be connected into an input circuit (by two wires) and an output circuit (two wires).  However, because the t

Architectural Design and Drawing, how can I improve my G+4 apartment with r...

how can I improve my G+4 apartment with rendering with pen and ink

Determine the log mean temperature, A tubular heat exchanger is being used ...

A tubular heat exchanger is being used for heating a liquid food from 30 o C to 70 o C. The temperature of the heating medium decreases from 90 o to 60 o C. a) Is the flow conf

Retaining wall design, #questionYour search - design a trapezoidal retainin...

#questionYour search - design a trapezoidal retaining wall(assume dimensions) ,bulk density 15kN per metre cube ,coefficient of friction of 0.7,angle of internal friction 15degres

Double acting propellers, Double acting propellers: This type of propel...

Double acting propellers: This type of propeller is normally fitted to larger engine and, because of engine requirements, is more complicated than the propellers fitted to smal

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