Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(1) how to do a program to prompt the user for an input and output file name. The program should check for errors in opening

(1) how to do a program to prompt the user for an input and output file name. The program should check for errors in opening the files, and print the name of any file which has an error, and exit if an error occurs.

For example, (user input shown in caps in first line, and in second case, trying to write to a folder which you may not have authority in)

Enter input filename: DOESNOTEXIST.T Error opening input file: DOESNOTEXIST.T Enter input filename: SOURCE.CPP Enter output filename: .. Error opening output file: .. 

(2) It should copy the input file, line by line, to the output file and to standard output so you can see it working

(3) Before the program exits, it should close all files.

(4) You will have to manually look at the output file to confirm the program ran correctly. A sample input file is listed below for your testing, or you may use source.cpp as your input to see your code copied to the output file. If you use our sample file, copy/paste the text into a new .txt file in the same folder as your source.cpp file, or your program won't be able to find it.

For example, (based on the input file we provide you, with user input shown in caps)

Enter input filename: FB.TXT Enter output filename: O.TXT File text: Copy this text file, exactly, line by line, without losing any words or whitespace. 

Sample input file "FB.TXT" which generated the above output:

 Copy this text file, exactly, line by line, without losing any words or whitespace. 

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions