Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I/O program for C Write a program in direct1.c which reads from standard input a line and then outputs that line immediately to standard output.

I/O program for C

Write a program in direct1.c which reads from standard input a line and then outputs that line immediately to standard output. it should read the first line only !

Then, write another program called direct2.c which reads from standard input every line until end of input and outputs them to standard output. Everything that goes in should come out exactly as it was.

Compile both programs and run them on the input files given below

The direct1 program should be run, redirecting input1.txt to standard input and redirecting output to output1.txt.

The direct2 program should be run, redirecting input2.txt to standard input and redirecting output to output2.txt.

Please write two programs direct1.c and direct2.c

Contents of Input1.txt Hi what is your name.

What What what What what

Contents of Input2.txt

The quick brown fox jumps over the lazy dog The lazy dog jumps over the quick brown fox.

So , output1.txt should display- Hi what is your name, (not all the whats below that)

On output2.txt , it should display

The quick brown fox jumps over the lazy dog The lazy dog jumps over the quick brown fox. (Entire document until end of line)

Please also write linux command for I/O redirection as mentioned in question . If you know only though .

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions