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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started