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

Continuous casting, Continuous Casting : In essential, the process consist...

Continuous Casting : In essential, the process consists of pouring molten metal into a short vertical metal die or mould (at a controlled rate), which is open at both ends, coolin

Refrigeration, can liquid reciever determine amount f refrigerant charged i...

can liquid reciever determine amount f refrigerant charged into the system

Corporate Strategy, Corporate Strategy Strategy In our earlier discussion...

Corporate Strategy Strategy In our earlier discussion, we made distinctions between merger and acquisition or takeover. However, they generally involve similar analyses and evalu

Budget and determining, In Corporate finance, Experts engaged in this occup...

In Corporate finance, Experts engaged in this occupation have the liability to increase the organization's revenue, shareholder's money, investment spending budget and determining

LIBS, Laser induced breakdown spectroscopy

Laser induced breakdown spectroscopy

Assignment on cost of capital, Atlas Inc. is planning to invest in a 4-year...

Atlas Inc. is planning to invest in a 4-year project which has the same risk as the firm’s existing assets and operations. The project requires a $150,000 initial investment and is

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

Architecture.., draw folded plate roof structure on multi purpose hall?

draw folded plate roof structure on multi purpose hall?

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