Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C programming 1. (20 points) Write a C program that finds and outputs words in a text file. The program should get the names of

C programming
image text in transcribed
image text in transcribed
1. (20 points) Write a C program that finds and outputs words" in a text file. The program should get the names of the input and output files from its command-line arguments (not by prompting the user as most of our programs have done) and should print appropriate error messages if fewer than two command-line arguments are given or if it cannot open the specified files. The input file can contain any characters- alphabetic, numeric, punctuation, etc. - but the output file should contain only the words" (sequences one or more alphabetic characters), each on a separate line, in lowercase. The program should also print (to standard output) the number of alphabetic characters and the number of total characters in the input file. So for example if file words-in.txt contains the following: hello vorld HELLO AGAIN and some numbers 1234 vords, words, words,words calling the program with the command ./a.out words-in.txt words-out.txt should print the line 54 alphabetic characters, 72 characters in all and produce a file words-out.txt containing the following: hello vorld hello again and some numbers worda words worda words Since the logic for this program is a little tricky, I recommend that you start by writing a simpler but somewhat similar program that just converts alphabetic characters to lowercase, copies newline characters unchanged, and converts all other characters to spaces. If you can't figure out the full problem, you can turn in this simpler program for part credit

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_2

Step: 3

blur-text-image_3

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

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions