Need this coded in C, no C++ functions can be used. Can include stdio.h, stdlib.
ID: 3685724 • Letter: N
Question
Need this coded in C, no C++ functions can be used. Can include stdio.h, stdlib.h, string.h, and ctype.h.
I need a function that will prompt the user for an input file name of a file containing data (integers and floats) that are four numbers to a line seperated by commas.
If the file name is invalid then an error msg should be printed and the program should exit
example of this error msg:
If no file name is entered an error msg should be printed and the program should exit
example of this error msg:
The function needs to be able to read up to the first 88(no more) valid numbers in a file and place them into a single dimensional array.
If the file has any non numerical data in a line that line of data is to be flushed and the program should continue reading at the next line but also keep track of which lines produced invalid data and print the following msgs when done reading:
The function should also count how many lines produced good data. Just a numerical total no need to remember each line.
The newly formed array and the total number of good lines should be passed to main so i may use it in other functions for the program. Do not worry about the file names just create a function that can do the tasks specified. I have the files it needs to read.
Your help would be greatly appreciated and if you do not have time to code this at least give me an outline that would be easy to follow for me to attempt to code myself.
Enter File Name: xyz Error: Could not open file xyz for read.