Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

File I/O and Structures: Write a C program, and save it as program9.c, which wil

ID: 3556420 • Letter: F

Question

File I/O and Structures: Write a C program, and save it as program9.c, which will access supplier data for a business. It will read the data from a file, save each supplier record in a structure, and use an array of structures to store all the records. It will also have a function which can generate a mailing list based on searching the supplier data, and will save the mailing list to an output file. Download the file "Data file for assignment 9" from Blackboard to your account in the lab and save it with the filename supplier .data. Each line of this file contains the data of a supplier record in the following format: The status of a supplier is a character which can have one of the following values: Use this type definition (in the global scope, right below any #include!s and #define's): Write the main function which has an array (called supplier_list) of 50 elements of type Supplier. Read the data from the input file supplier. data into the elements of your array using code something like this: For your convenience, the following version of the read_supplier_record function is provided, which you may use if you like, or you may write your own function to read the data from the file and divide it into the members of the Supplier structure: Prompt the user to select a status to filter by for generating a mailing list. Where the user must enter a character to choose a particular status, if an invalid selection is made, keep prompting for a selection until a valid choice is made. Also, if a particular letter is a valid choice, then accept that letter in either upper- or lower-case. Write a function to search through the supplier records and find the ones which match the requested status value. The matching supplier data must be written to an output file named mail.list with each name and address on one line in a format like the following: Note that white space at the end of strings read from the input data file is removed and not part of the output . After attempting to open the input file and the output file, check if the file opened successfully, and if not then exit the program. Be sure to close both the input file and the output file before the program terminates. If the program reaches the end (i.e. didn't quit early because a file couldn't be opened), then print a message to the screen that an output file was generated, like the message shown in the sample run below. A sample run of your program should look like: A supplier mailing list will be generated based on supplier status. Enter the supplier status for which to generate a mailing list: b Mailing list matching your selection was generated and saved in the file mail.list. The above sample run must write an output file called mail, list with the following contents: Use functions as needed to make your program well-organized. Some fields in an input record may have embedded spaces, such as the street address and the city fields. Using fscanf with a format of "%s" will not get characters of the field after a space. Using fscanf with a format of "%nc" can avoid this problem. Section 22.3 of the textbook on formatted I/O, in particular the . . .scanf section starting on p.559, has more information about this. The isspace function from string.h might be useful.

Explanation / Answer

This program is too long. First open a new file and name it "program9.c"

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote