There are two functions declared in csv.h. You must define both of these functions in csv.c. Each function reads the next field from a CSV file. One expects the field to be a string, and the other expects the field to be a decimal integer. int getCsvstring (char * str, FILE* fp); int getCSvInt (int * num, FILE fp Both functions return 1 if the read is successful, and 0 otherwise. Because we are reading one field at a time, the functions do not know whether the field should end in a comma or end in a linefeed. In either case, the ending character (comma or linefeed) must be read and ignored, so that the file pointer is positioned at the beginning of the next field. Each test will run one function multiple times, reading successive records from a CSV file. The description of the test will tell you what type of record is being read. LAB 13.4.1: HW7 – CSV Files 0/100 АCTIVITY Current file: cSv.h File is marked as read only CSv.n; TuncIoNS Teld Leu co OV L SATTI 4 #ifndef ALBUMS_CSV_H 5 #define ALBUMS_CSV_H 6 7 #include <stdio.h> 8 9 getCSVString: Extract the next field from a CSV file, as a string 10 /Field is stored into str — caller must be sure that str is large enough 11 /Return values: 12 0no field extracted (could be error, or could be EOF) 13 /1 success, field extracted 14 if 0 returned str could be changed, but caller should ignore 15 File pointer fp must be moved to the beginning of the next field to be read 16 17 int getCSVString(char str, FILE* fp); 18 19 getCSVInt: Extract the next field from a csV file as a decimal integer 20 Caller provides the address where integer should be stored 21 //Return value: 22 no integer extracted (could be error, or could be EOF) 23 1 success, field extracted 24 if 0returned, *num could be changed, but caller should ignore 25 File pointer fp must be moved to the beginning of the next field to be read 26 27 int getCSVInt (int * num, FILE* fp) 28 29 #endif //ALBUMS_CSV_H Show transcribed image text There are two functions declared in csv.h. You must define both of these functions in csv.c. Each function reads the next field from a CSV file. One expects the field to be a string, and the other expects the field to be a decimal integer. int getCsvstring (char * str, FILE* fp); int getCSvInt (int * num, FILE fp Both functions return 1 if the read is successful, and 0 otherwise. Because we are reading one field at a time, the functions do not know whether the field should end in a comma or end in a linefeed. In either case, the ending character (comma or linefeed) must be read and ignored, so that the file pointer is positioned at the beginning of the next field. Each test will run one function multiple times, reading successive records from a CSV file. The description of the test will tell you what type of record is being read. LAB 13.4.1: HW7 – CSV Files 0/100 АCTIVITY Current file: cSv.h File is marked as read only CSv.n; TuncIoNS Teld Leu co OV L SATTI 4 #ifndef ALBUMS_CSV_H 5 #define ALBUMS_CSV_H 6 7 #include 8 9 getCSVString: Extract the next field from a CSV file, as a string 10 /Field is stored into str — caller must be sure that str is large enough 11 /Return values: 12 0no field extracted (could be error, or could be EOF) 13 /1 success, field extracted 14 if 0 returned str could be changed, but caller should ignore 15 File pointer fp must be moved to the beginning of the next field to be read 16 17 int getCSVString(char str, FILE* fp); 18 19 getCSVInt: Extract the next field from a csV file as a decimal integer 20 Caller provides the address where integer should be stored 21 //Return value: 22 no integer extracted (could be error, or could be EOF) 23 1 success, field extracted 24 if 0returned, *num could be changed, but caller should ignore 25 File pointer fp must be moved to the beginning of the next field to be read 26 27 int getCSVInt (int * num, FILE* fp) 28 29 #endif //ALBUMS_CSV_H
Expert Answer
Answer to There are two functions declared in csv.h. You must define both of these functions in csv.c. Each function reads the nex…