Develop a c program

Assignment Help C/C++ Programming
Reference no: EM131166024

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

 

Reference no: EM131166024

Questions Cloud

How can you make improvements with a new system : What does the credit card charge form indicate about the existing system? How can you make improvements with a new system?
Explain the four elements of negligence : Discuss the court's findings and explain how the court determined this was a negligence case rather than an intentional tort. Explain the four elements of negligence and the reasoning of the court when analyzing each element.
What implications does the business model have for systems : Do you agree with Dogster's view, or should companies aim for "zero-defect" operations? Why or why not? What implications does this business model have for systems analysts?
What are ebit under the best case scenario : The estimated sales price is $80 a unit, plus or minus 4 percent. Variable costs are estimated at $55 a unit, plus or minus 5 percent, and the fixed costs are $25,000, plus or minus $25,000. What are EBIT under the best case scenario?
Develop a c program : 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 ex..
What techniques can you use to identify improvements : What techniques can you use to identify improvements? Choose one technique and apply it to this situation- what improvements did you identify?
Explain the costs and the benefits of the production : Why do you think your policy would work in reducing the total amount of emissions? In your answer, explain the costs and the benefits of the production and consumption of the good, as well as the negative externality
Which approach seems to be more successful : A system development project may be approached in one of two ways: as a single. Which approach seems to be more successful? Why do you suppose that this is true?
What is the value of expressing one probability in events : If you roll two dice, what is the probability of an even sum or a sum of 8 or more?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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