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

Enthalpy, What is the deference between enthalpy anne internal energy u

What is the deference between enthalpy anne internal energy u

Hoppala, Please help me to compare the minimum cell cost method and Vogel''...

Please help me to compare the minimum cell cost method and Vogel''s approximation method to find initial basic solution. Generally the sources indicated that the Vogel''s method gi

Biomediacl instrumentation, Design a dc-coupled one op amp circuit that wil...

Design a dc-coupled one op amp circuit that will amplify the 100uV EOG to have the maximal gain possible without exceeding the ttypical guarenteed linear outpt range.

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

Strain energy release rate , The energy release rate, often denoted by G, i...

The energy release rate, often denoted by G, is the amount of energy per unit area that is supplied by the elastic energy in the body and loading system in creating a new fracture

Bajaj electronics, HOW WOULD YOU JUDGE THE POTENTIAL PROFIT OF BAJAJ ELECTR...

HOW WOULD YOU JUDGE THE POTENTIAL PROFIT OF BAJAJ ELECTRONICS ON THE FIRST YEAR OF SALES TO BOOTH PLASTICS AND GIVE YOUR VIEWS TO INCREASE THE PROFIT?

Turbine discs and blades of aircraft, Turbine Discs and Blades: The ins...

Turbine Discs and Blades: The inspection for cracks is of the utmost importance, most inspections are visual, the dye penetrant method of inspection being too impractical. Crac

Structural engineering question, I have a 30'' simple span beam, braced at ...

I have a 30'' simple span beam, braced at the supports only. Uniform load is 1200 plf. I need deflection limited to L/400. What size steel beam do I need?

Logic gate - not gate, THE INVERTER ('NOT' GATE) Figure shows the symbo...

THE INVERTER ('NOT' GATE) Figure shows the symbol for an inverter, where the output will produce the complement of the input. This device is often employed when the complement

Mergers & acquisitions / valuing synergies, 1-calculate the present value o...

1-calculate the present value of the expected synergies. ( Assume a tax rate of 35%. a discount rate of 10% suitable for the cost oand revenue synergies combined, and inflation of

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