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

Assignmentinstructions the following programming problem

Assignment Instructions: The following programming problem can be solved by a program that uses three basic tasks-Input Data, Process Data, and Output Results. To process the data, it uses loops, arrays, decisions, accum ...

Creating methodssince you have created the data objects for

Creating Methods Since you have created the data objects for Harbor View Mooring, you now need to create processes associated with each object. In order to keep with good object-oriented practices of implementation hidin ...

Generate code for the given three-address statements

Generate code for the given three-address statements assuming all variables are stored in memory locations. a) x = 1 b) x = a c) x = a + 1 d) x = a + b e) The two statements x = b * c y = a + x

Design a class named pet which should have the following

Design a class named Pet, which should have the following fields: •Name - The name field holds the name of a pet. •Type - The type field holds the type of animal that is the pet. Example values are "Dog", "Cat", and "Bir ...

Assignmentwrite a narrative describing the objective of the

Assignment Write a narrative describing the objective of the program, and what each routine will do, including the reason for and purpose of the array(s), in addition to the selection statement and use of iterations Expl ...

Assignment- computer applications for businesslearning

Assignment- Computer Applications for Business Learning Objectives: This assignment is designed to practice: 1. Basic understanding of JavaScript variables, including; a The declaration, initialization and assignment pro ...

Assignmenthomework assignments must be individuals original

Assignment Homework assignments must be individual's original work. Discussion without taking notes will be fine, but collaborations will not be tolerated. Dishonesty will result in an automatic F grade and a formal char ...

Write a lex program that converts a le to pig latin

Write a Lex program that converts a le to Pig Latin." Specially, assume the le is a sequence of words (groups of letters) separated by whitespace. Every time you encounter a word: 1. If the First letter is a consonant, m ...

Assignmentanalyze each problem develop a solution and

Assignment Analyze each problem, develop a solution and implement your solution. Copy and paste your program and a sample output below each problem. Define the class Point in a rectangular coordinate system. This class m ...

Question 1 batteriesi want to use a galvanic cell to power

Question 1: Batteries I want to use a galvanic cell to power a 60-watt light bulb. Complete the following steps to determine how long the galvanic cell will power the light bulb before running out. a.) The galvanic cell ...

  • 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

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

Describe what you learned about the impact of economic

Describe what you learned about the impact of economic, social, and demographic trends affecting the US labor environmen