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

  Develop a global function customerinformation

Use a parameterized constructor to initialize data members - Develop a global function "CustomerInformation" that prints the customers information (number of dept each customer can handel). ( Use copy constructor).

  Part asuggest an application system which is able to

part asuggest an application system which is able to perform some arithmetic computations like commission system

  Compare and contrast the object-oriented approach to design

compare and contrast the object-oriented approach to design and the traditional approach.do you believe that there are

  Program that uses non recursive function to search

Write a C program that uses non recursive function to search for a key value in a given sorted list of integers usingt Binary search

  Convert code c to c++

I don't know where to start and how I should go about doing this and am looking for some advice - the code just has to compile in g++, it does not need to be completely rewritten in C++.

  End of the string and then print the results

Write a C++ code that declares a regular C++ null-terminated string that holds upto 20 characters, reads user input into the string, appends an exclamation to the end of the string and then print the results.

  Write a program that declares three one dimensional

Write a program that declares three one dimensional arrays named miles, gallons, and mpg . Each array should be declared in main( ) and should be capable of holding ten double

  Write a program that asks you to enter your height in inches

Write a program that asks you to enter your height in inches and then displays your height in centimeters. Or, if you prefer, ask for the height in centimeters and convert that to inches.

  Downloading movies, and completing schoolwork

Allison spends a lot of time socializing with friends on Facebook, downloading movies, and completing schoolwork. But her older computer needs to be replaced because the latest operating system cannot be installed on her older machine without signifi..

  How many themes does each of your new relations contain

Does this relation contain a multi-value dependency? If so, what are the unrelated attributes?

  Write a program that asks user to enter

Write a program that asks user to enter the size of the matrix (rows and column) then, it asks the user to enter the elements of two matrices and finally it adds two matrix and displays the result in C language.

  Area of information security awareness

For this research exercise, write a 4-5 page APA style paper summarizing research in the area of Information security awareness. You may address and focus on any topics that fall within information security awareness theories and programs.

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