Develop a C program for Linux called pipes

Assignment Help Taxation
Reference no: EM131166083

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: EM131166083

Questions Cloud

How many allowable moves are needed to move the disks : Describe the strategy you have used or would use in a recursive program to solve this problem.
Amount of initial investment : You invested in classic cars 7 years ago. You have earned an average compounded annual rate of 22 percent. The investment is now worth $350,000. What was the amount of your initial investment?
Amount of the current liabilities : The Corner Shoppe has a current ratio of 1.4, net fixed assets of $26,800, and total assets of $32,400. What is the amount of the current liabilities?
Determine the present value : Determine the future value (FV) of this annuity if your first $5,000 is invested at the end of the first year.- Determine the present value.
Develop a C program for Linux called pipes : 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..
What is a recurrence for the running time of select1 : Let T(n) be the running time of the modified Select1 on n items. How can you express the running time of Magic Middle in terms of T(n)?
What is the equilibrium price and quantity of cigarettes : Suppose a public referendum is being held on whether or not to levy a tax on cigarettes. Currently, the supply of cigarettes is given by Qs = -900 + 200P. You estimate the demand for cigarettes to be Qd = 1200 - 50P. What is the equilibrium price ..
How do you find the second smallest element : How do you find the minimum (i = 1) or maximum (i = n) in a set? What is the running time? How do you find the second smallest element? Does this approach extend to finding the ith smallest? What is the running time?
What are the typical features of mammals : What are the typical features of mammals - What are the three major groups into which mammals are divided?

Reviews

Write a Review

Taxation Questions & Answers

  Evaluate income tax expense

The income tax rate for 2008 was 30 percent. Eric had unused $60,000 new operating loss carryforward arising in 2007 when the tax rate was 35 percent - Evaluate income tax expense of Eric's report for 2008

  Compute dan and cheryls income tax liability

Compute dan and Cheryl's income tax liability for 2011. Disregard the alternative minimun tax.

  Comparisons of operating and sales type leaseson january 1

comparisons of operating and sales type leaseson january 1 2013 nelson company leases get property to queens company at

  The transfer tax has been modified numerous

The transfer tax has been modified numerous times since the 1970s. There have been many arguments for and against this tax. Let's take a look at some of those changes and why the changes were made. What was the political environment at the time? What..

  How do they determine the amount of the payment

Conceptually, when taxpayers receive annuity payments, how do they determine the amount of the payment they must include in gross income?

  Paul pay in estimated taxes to avoid a penalty

How much must Paul pay in estimated taxes to avoid a penalty?

  Build a new production plant factory

Concrete & Transport Limited carries on business as a manufacturer and supplier of concrete and concrete products. It also operates a railway to transport material and products to and from port facilities.

  Estate taxes on large retirement plan balance

Estate Taxes on Large Retirement Plan Balance: Dr. Norma, Dr. Norma is 68. She has a $10 million IRA, a home worth $2 million and few other assets. She wants to leave all her assets to her three children, and save taxes

  What is the consumption tax rate for india and china

An import tax. This tax applies to import only. It does not apply to home products. What is The consumption tax rate for India and China.

  What is dms depletion expense for years one to three

What is DM's depletion expense for years 1-3? What is DM's research and experimentation amortization for years 1 and 2?

  Calculate henrys deduction for car expenses

Calculate Henry's deduction for car expenses under each of the four methods in Div 28 of ITAA 1997. Use the "cents per kilometer" amounts for the 2009-10 year in answering this question.

  What will kelseys gross tax

What will Kelsey's gross tax be in 2014 and 2015 if she contributes $1,500 to charity in each year? What will her gross tax be in 2014 and 2015 if she contributes $3,000 to charity in 2014 but makes no contribution in 2015?

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