Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed
image text in transcribed
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

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

Excel 2024 In 7 Days

Authors: Alan Dinkins

1st Edition

B0CJ3X98XK, 979-8861224000

More Books

Students also viewed these Databases questions

Question

6. How do histories influence the process of identity formation?

Answered: 1 week ago