Develop a c program for linux, C/C++ Programming

Assignment Help:

develop a C program for Linux calledpipes.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). You can edit your program with the geditapplication, available from the command line. Or install emacs using command "sudo apt-get install emacs" and learn to use it.


Related Discussions:- Develop a c program for linux

Luminous jewels, Problem : Luminous Jewels - Polishing Necklace Byteland c...

Problem : Luminous Jewels - Polishing Necklace Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of v

Develop a complex app, Project Description: I would like to be building ...

Project Description: I would like to be building regarding a complex mobile application build as we require the signing of an NDA. My firm in based in Montreal Canada and we are

Answer, Write a program to find the area under the curve y = f(x) between x...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.

Define advantages of multi file program, Define Advantages of Multi File Pr...

Define Advantages of Multi File Program? The main merits of spreading a program across several files are: • Teams of programmers able to work on programs. Every programmer w

Expression, i need expression and its types with example programs in c++

i need expression and its types with example programs in c++

C program for sorting of character , #include stdio.h> #include conio.h>...

#include stdio.h> #include conio.h> #include string.h>   void main() {           char a[50],b[25][25],l[25],temp1;           int i=0,j=0,k=0,l1[25],c=0,c1=0,t=

Create a custom calculator program, //Create a custom calculator program ca...

//Create a custom calculator program capable of reading the input stream of an expression //and make basic computations to provide answer. //Your program will ask the user to

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