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

Oscilloscope probes, Direct probe,isolation probe,high impedence probe,acti...

Direct probe,isolation probe,high impedence probe,active probe,current probe

Inheritance and polymorphism, The objective of this programming assignment ...

The objective of this programming assignment is to experience the use of inheritance in Java and to see how polymorphism works with inheritance in Java. The assignment involves wri

Time value of money-inflation-interest rate-opportunity cost, Time Value of...

Time Value of Money Consider your cheese steak hoagie business. Assume that Phillies will win another World Series, and your business will be hired to serve a party that will

Decision table software engineering, Write a decision table that specifies ...

Write a decision table that specifies the rules for the game of checkers.

Homework, name the functions of the CIPM

name the functions of the CIPM

Logic gates - and gate, Logic gates - and gate: Figure shows the symbol...

Logic gates - and gate: Figure shows the symbol that represents 2 input AND gate together with its truth table. This gate will only adopt a 1 state at its output terminal when

Homework, name the functions of the CIPM

name the functions of the CIPM

Composite materials - notation of axes, Notation for Body Axes The stan...

Notation for Body Axes The standard notation for the body axis sytem for aircraft dynamics. This sectionexplains the signi?cance of the term body axis and develops the non-line

Quantitative, Case 1: Decision Analysis Flifla sells tomatoes every day in...

Case 1: Decision Analysis Flifla sells tomatoes every day in Suk al Marqazi, the downtown fruit and vegetable market. He finds that he can order tomatoes in crates of 25 kg and he

Steamtables, How to draw diagrams for Rankine cycle

How to draw diagrams for Rankine cycle

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