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

Dsp, Dit fft idft

Dit fft idft

Crystal structure, how can we determine the crystal structure of material b...

how can we determine the crystal structure of material by having interplanar spacing d?

Tin smelting, How can calculate for charging of tin smelting with reverbera...

How can calculate for charging of tin smelting with reverberatory furnaces?

Diffusion, distingush between short range and long range diffusion

distingush between short range and long range diffusion

Damping coefficint of canatrd of aircraft, what will be the methodology to ...

what will be the methodology to calculate pitching moment damping coefficient of canrad of aircraft

Vlsi, how to find out the number of select lines while construcing a mux or...

how to find out the number of select lines while construcing a mux or a demux logic diagram?

Java , why we need EJB

why we need EJB

Msor, write a note on tracing a closed loop.what are the characteristic,fea...

write a note on tracing a closed loop.what are the characteristic,features of a closed loop.

Financial Ratio, The following information was extracted from the accountin...

The following information was extracted from the accounting records of De Walt Company as at 28 February 2011 (the end of their financial year): Sales (50% on credit) 1 400 000 Cos

Fire risk assessment in uk - fire protection engineering, Fire risk assessm...

Fire risk assessment in UK: In the UK FRAs are required by law in all commercial premises.  But the FRAs are not the same as described in NFPA 551.  The principles remain the

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