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

Governing equations of typical section aerofoil, We recall the "typical sec...

We recall the "typical section" aerofoil model with oscillating pitching and plunging motions to represent the torsional and bending behaviour of a wing structure with large aspect

Embedded system, I have an assignment of engine control unit (hardware desi...

I have an assignment of engine control unit (hardware design and programming) if you have an expert.....

Why is earth geologically active, Expertsmind.com brings you unique soluti...

Expertsmind.com brings you unique solution in physics Why is earth geologically active?        1- Internal Structure: -               -Core : The highest densi

Basic instrumentation system, A basic instrumentation system consists of a ...

A basic instrumentation system consists of a transducer, conditioning amplifier, and analog digital converter connected (in general) by analog and digital transmission lines.

Timber, micro structure of exogenous tree

micro structure of exogenous tree

Diffusion, distingush between short range and long range diffusion

distingush between short range and long range diffusion

Static and dynamic balancing - propellers, STATIC & DYNAMIC BALANCING ...

STATIC & DYNAMIC BALANCING STATIC BALANCE When the weight distribution about the propeller axis is equal, with the propeller in any position, it is said to have static bal

Summing amplifier, Summing amplifier: As the title implies, this is an ...

Summing amplifier: As the title implies, this is an adding device.  The circuit can take any number of voltage inputs, and the output voltage is simply the sum of these inputs.

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