Question: Driver File: #define INSTRUCTOR_FILE #ifdef INSTRUCTOR_FILE #include #include #define FILENAME TestFile10.txt FILE *OpenFile(const char *fileName); void ParseStringFields(FILE *fp); int main(void) { FILE *fp = OpenFile(FILENAME);

 Driver File: #define INSTRUCTOR_FILE #ifdef INSTRUCTOR_FILE #include #include #define FILENAME "TestFile10.txt"
FILE *OpenFile(const char *fileName); void ParseStringFields(FILE *fp); int main(void) { FILE *fp
Driver File:
#define INSTRUCTOR_FILE
#ifdef INSTRUCTOR_FILE
#include
#include
#define FILENAME "TestFile10.txt"
FILE *OpenFile(const char *fileName);
void ParseStringFields(FILE *fp);
int main(void)
{
FILE *fp = OpenFile(FILENAME);
ParseStringFields(fp);
fclose(fp);
return EXIT_SUCCESS;
}
#endif
TextFile10.txt:
REC_NO; ++i) /* lo o p through unne e ded records LOOP */
if (fsc?anf(fp, "%*[^ ]%*c") == EOF) { /* se e d & thro w away */
TextFile12.txt:
R / scanf[.]/ pr intf
/;}? cin ?.!cout ?,;:=+ + C++
e n
,#! text file !/: bye:/\ \

C2A3E4 (8 points - Program) Exclude any existing source code files that may already be in your IDE project and add two new ones. naming them c2A3E4 OpenFile.c and C2A3E4 ParseString Fields.c. Also add instructor-supplied source code file C2A3E4_main-Driver.c. instructor-supplied file and it will use the code you write. Do not write a main function main already exists in the Often programs must read text files containing data fields of arbitrary length separated by arbitrary delimiters, such as commas, semicolons. etc. For example: Hello, John Doe, Susan J. Smith File C2A354_OpenFile. must contain a function named OpenFile. OpenFile syntax: FILE *OpenFile(const char *fileName); Parameters: fileName -a pointer to the name of the file to be opened Synopsis: Opens the file named in fileName in the read-only text mode. If the open fails an error message is output to stderr and the program is terminated with an error exit code. The error message must mention the name of the falling file. Return: a pointer to the open file if the open succeeds: otherwise, the function does not return. File C2A3E4 ParseString Fields.c must contain a function named ParseStringFields. ParseStringFields syntax void ParseStringfields(FILE *fp); Parameters: fp - a pointer to a file open in the read-only text mode Synopsis: Reads input from the text file in fp one line at a time and uses the strtok function to find each delimited field and display it on a separate output line. The characters "AEIOUaeiou\t " are treated as delimiters and any/all whitespace at the beginning of any field is skipped, with the isspace function being used to detect such whitespace. Certain character sequences will result in blank output lines or lines ending with one or more whitespaces. Retum: vold You may assume that lines will always contain less than 255 characters. Test your program using instructor-supplied data files TestFile 10.txt and TestFile 12.txt, which must be placed in the program's "working directory". . 3 Example: A properly written program would produce the display shown on the next page if the following two lines were read: John Jones, 2345 Bo Inlet St., Isle Ohau, USA Mary Lu,876-1/2 Back Road Dr., BC, Mexico Observe that the display contains no leading whitespace and there are 19 total lines, with two of them being blank. Do not show line numbers or anything else that is not actually in the file. Sample Display 3 hn ) n 5,2345 B nl t St., s1 h > S M ry ,876-1/2 B ckr d Dr., BC, M Submitting your solution Send all three source code files to the assignment checker with the subject line C2A3E4_ID, where ID is your 9-character UCSD student ID. See the course document titled "How to Prepare and Submit Assignments" for additional exercise formatting, submission, and assignment checker requirements. Hints: Read one line at a time from the file and parse it with strtok. Be sure to skip leading whitespace. Whitespace is not just the space character itself but every character defined by the isspace function

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!