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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!