Introduction
For this assignment, you will perform basic ASCII file Input and Output. Your program will read a series of questions from an input file, present them to the user, get the user's responses to the questions, and write both the questions and the responses to an output file.Specifications
You program will begin by prompting the user to enter two filenames. The first filename will be the input file that contains the questions. The second filename will be the output file where the questions and responses will be written. Once the filenames are known, the program will open the two files, one for input and one for output.Your program will then enter a loop which will read each question from the input file, print the question to the console, and get the user's response to the question from the console. It will then write both the question and response to the output file. Your program will continue to do this until there are no more questions to be read from the input file. It will then close both files and exit.
You may assume that no question in the input file will be longer than 80 characters, and that there will be no user response longer than 80 characters. Your program will handle errors gracefully, such as when the input file doesn't exist, or there is an issue opening the output file. In these cases, you will print an error message to the console and exit the program. Your source code file will follow the standard file naming conventions found in earlier labs (HW6_username.c).
Comments
Post a Comment