Question: c programming Using the language, write a program called hw1.c and compile it to generate hw1.o. gcc hw1.c -o hw1.o The program should be invoked

c programming  c programming Using the language, write a program called hw1.c and
compile it to generate hw1.o. gcc hw1.c -o hw1.o The program should

Using the language, write a program called hw1.c and compile it to generate hw1.o. gcc hw1.c -o hw1.o The program should be invoked like this: ./hw1.o -i input file -o output file or ./hw1.0 -0 output file -i input file That is, the -i switch can appear before the -o switch or after (you should be able to handle both situations) where: o input file: path to a text file that contains several sentences (1 sentence per line). For example, the content of inputfile can be: Ububtu virtual machine Do not forget that arrays begin at zero Remove the null terminator Five incredible postseason comebacks You can assume that: a) Each line is less than or equal to 511 characters long (512 with the trailing null '\0'). b) All lines end with a trailing newline ' ' e: path to a file that does not exist. Your program should create this file and populate it with the sentences from input file but with words shown in reverse order. Taking the above as an example, a correct output file should contain the following: nachine virtual Ubuntu zero at begin arrays that forget not Do terminator null the Remove comebacks postseason incredible Five If the program is invoked with the wrong number of arguments, you should print to stderr the following and exit: usage: progi.o -i - If the program is invoked with an input file that does not exist, you should print to stderr the following and exit: File input file does not exist

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!