Make a C program that gets a source file name from a user. If the file does not exist, it will generate a proper error and exits. If the file exists, it also gets the name of two more files from the user, say destination1 and destination2. These files don't need to exist as they are files that need to be written to. If the files cannot be opened for writing, a proper error will be generated.     The program then reads the source file line by line. It will copy every line that has a digit in it to destination 2 and lines that have no digit in them to destination 1. Feel free to use ctype's isdigit() function to identify digit characters.   Example: If source file is: Hi My name is Veria Hello My name is John. How can I help you? I have a problem with my giga bit internet. The speed should be around 1000 but it's just 200 Sure! I can help with that. Can I have your number in case we get disconnected? Sure! My number's 647-123-1234   First file (destination 1) should be Hi My name is Veria Hello My name is John. How can I help you? Sure! I can help with that. Can I have your number in case we get disconnected?   Second file (destination2) should be I have a problem with my giga bit internet. The speed should be around 1000 but it's just 200 Sure! My number's 647-123-1234   The program then displays a report mentioning how many lines were copied into each destination file.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question

Make a C program that gets a source file name from a user. If the file does not exist, it will generate a proper error and exits.

If the file exists, it also gets the name of two more files from the user, say destination1 and destination2. These files don't need to exist as they are files that need to be written to.

If the files cannot be opened for writing, a proper error will be generated.

 

 

The program then reads the source file line by line. It will copy every line that has a digit in it to destination 2 and lines that have no digit in them to destination 1. Feel free to use ctype's isdigit() function to identify digit characters.

 

Example:

If source file is:

Hi My name is Veria

Hello My name is John. How can I help you?

I have a problem with my giga bit internet. The speed should be around 1000 but it's just 200

Sure! I can help with that.

Can I have your number in case we get disconnected?

Sure! My number's 647-123-1234

 

First file (destination 1) should be

Hi My name is Veria

Hello My name is John. How can I help you?

Sure! I can help with that.

Can I have your number in case we get disconnected?

 

Second file (destination2) should be

I have a problem with my giga bit internet. The speed should be around 1000 but it's just 200

Sure! My number's 647-123-1234

 

The program then displays a report mentioning how many lines were copied into each destination file. 

Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education