![]() |
CMSC104Problem Solving & Computer Programming |
Make sure that you follow all the coding standards
Do the following to extend the Number to String Conversion Program :
Instead of reading in input from the keyboard, read in a value from a file, convert it into words, write it out to a different file.The name of the input file should be the first command line argument The name of the output file should be the second command line argument The input file will contain one value per line. Continue to read and process the input file until there are no more lines left to read.
Make sure to:
Test whether the user passed in the two arguments. If not, print out "Usage: ./fileio input.txt output.txt", and exit the program. Make sure to test whether the files were opened correctly before reading/writing to them. If there was an error opening the file, exit the program.
Reference the following code examples :
args.c file_io.c convertToString.c
From Linux on the GL machine:
Write a C program (see below) and save it in a file called fileio.c in your ./CMSC104/cw5 directory Compile the program:
gcc -o fileio fileio.c
Run the program to make sure it works:./fileio input.txt output.txt
Use the SUBMIT utility to turn in the homework.submit cs104_grasso cw05 fileio.c fileio