Question: Write a program in C... Your programs should only use system calls for obtaining input and generating output. For example, use read() and write() system

Write a program in C...

Your programs should only use system calls for obtaining input and generating output. For example, use read() and write() system calls instead of C library functions (e.g. scanf or printf) to fetch input and display output.

The program should accept only one string argument that will be used to create a new file. For example, "./thisProgram filename". Your program should check that the argument is valid and that the file doesnt already exist. The filter program then reads from STDIN and writes to both STDOUT and to the (newly created) file. Any error messages to be displayed should be sent to STDERR.

This means that you will type "./thisProgram filename" and hit enter. Then all text typed gets inserted into the new file in a new line for each new line typed until "Ctrl+D" is pressed to close the program.

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!