Question: Write a program that will add line numbers to a file. You must ask the user for two filenames, one for the input file and

Write a program that will add line numbers to a file. You must ask the user for two filenames, one for the input file and one for the output file. Open both files. While the end of the input file is not reached, read the next line in the input file add the line number and write the line to the output file.

Before running the program, create an input file using an ASCII editor like NOTEPAD with at least 10 lines. Do not use the current C program as the input file. In fact do not use any file that you need since if the program fails it will destroy the file you are inputting.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!