Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions 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
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education