Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask Programming Language Expert

Build up a C program for Linux called pipes.c that does the subsequent:

In the main() function, it creates a pipe using the pipe() function, then generates two child processes with fork(). Child 1 redirects stdout to the prepare end of the pipe and then executes with execlp() the "ls -al" command. Child 2 redirects its input from stdin to read end of the pipe, then it executes the "sort -n -k 5" command.

After making both children, the parent process waits for them to terminate before it can exit.

Note that you might have to generate Child 2 first, followed by Child 1.

The parent program does the similar thing as a shell that runs the command "ls -al | sort -r -n -k 5".

You should use the fork(), pipe(), dup2(), close(), execlp() attributes (or other exec() variation). You can edit your program with geditapplication, accessible from the command line. Or install emacs using command “sudo apt-get install emacs” and learn to use it.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91546

Have any Question? 


Related Questions in Programming Language

The car classdefine a class called car that implements the

The Car Class Define a class called "Car" that implements the parameterized Comparable interface. Each object of this class represents a type of car. Your class must provide all the methods in the public interface. Be su ...

Suppose a basic block is formed from the c assignment

Suppose a basic block is formed from the C assignment statements x = a + b + c + d + e + f; y = a + c + e; a) Give the three-address statements (only one addition per statement) for this block. b) Use the associative and ...

Fundamentals functions amp arraysplease refer to

Fundamentals, Functions & Arrays Please refer to announcements for details about this exam. Make sure you fill the information below to avoid not being graded properly; Here is the grading matrix where the TA will leave ...

Project on grammarsnbspcourseist 230cmpsc

PROJECT ON GRAMMARS   Course: IST 230/CMPSC 360   Deadline: see the calendar in Canvas for the deadline   Objective: To acquire a comprehensive understanding of the application of grammars and formal language theory to c ...

A theater-seating chart is implemented as a two-dimensional

A theater-seating chart is implemented as a two-dimensional array of ticket prices, like this: ROW 6: 10 10 10 10 10 10 10 10 10 10 ROW 5: 10 10 10 20 20 20 20 10 10 10 ROW 4: 20 20 20 20 20 20 20 20 20 20 ROW 3: 20 20 3 ...

Retail transaction programming projectproject requirements1

Retail Transaction Programming Project Project Requirements: 1. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The Lin ...

Assignmentinstructionsfor formload display use a textbox

Assignment Instructions: For Form_Load display, use a textbox and check its "multiline" checkbox. To display data on Form_Load, use a txtOutput. AppendText() method (i.e. NOT a listbox control). 1. Declare a global array ...

Write a program which1 asks the user to enter a positive

Write a program which: 1. Asks the user to enter a positive integer greater than or equal to 0 2. Validates that the entry is a positive integer 3. Outputs the digits in reverse order with a space separating the digits 4 ...

Lab- forms loops and stringssubmission Lab- Forms, Loops and Strings Submission

Lab- Forms, Loops and Strings Submission Instructions How Please submit your lab report to the Lab4_Submission folder in Moodle. When Labs are due in 1 week on Feb. 13, 2014 Exercises: Goals: - Gain more hands-on with us ...

1 devise a register-allocation strategy on the assumption

1. Devise a register-allocation strategy on the assumption that we automatically store all registers on the stack before each procedure call and restore them after the return. 2. Construct the register-interference graph ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

WalMart Identification of theory and critical discussion

Drawing on the prescribed text and/or relevant academic literature, produce a paper which discusses the nature of group

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro