Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program called chain3. It will do the following: 1. Prompt the user for an input file. You may assume the filename is

Write a C program called chain3. It will do the following:

1. Prompt the user for an input file. You may assume the filename is less than 1200 characters. It will ask by printing a prompt that says 'enter input file: '.

2. Prompt the user for a 1st command to run(as a single line of input). You may assume that the input line is less than 4000 characters. It will ask by printing a prompt that says 'enter first command: '.

3. Prompt the user for a 2nd command to run, as a single line of input. You may assume that the input line is less than 5000 characters. It will ask by printing a prompt that says 'enter second command: '.

4. Prompt the user for a 3rd command to run, as a single line of input. You may assume that the input line is less than 4000 characters. It will ask by printing a prompt that says 'enter third command: '.

5. Prompt the user for an output file. You may assume the filename is less than 1000 characters. It will ask by printing a prompt that says 'Please enter an output file: '.

6. It will then cause the 3 commands to be executed. The 1st command will get its input from the input file. The 1st commands output will be redirected to the input of the 2nd command. The 2nd commands output will be redirected to the input of the 3rd command. The 3rd commands output will go into the output file.

Other requirements:

The output file should be replaced, not appended to. You cannot use the system() function call. You must use an exec call to run the commands. The commands entered may have arguments. You need to break up the line entered into the command itself, plus the arguments. You may assume there are no more than 50 arguments for each command.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

What are Fatty acids?

Answered: 1 week ago

Question

What are Electrophoresis?

Answered: 1 week ago