Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write two functions, which read/write an array of records to/from a file. Write driver code to test the two functions. The driver code and the
Write two functions, which read/write an array of records to/from a file. Write driver code to test the two functions. The driver code and the test output must show clearly that the file input and output work correctly Requirements 1. Definition of Record Create a header file, record.h, containing the following definition. Note that the structure is different from the one used in the previous assignments. struct record accountno; name [251: address[BO]; char char 2. Read/Write Functions Create a source file, iofunctions.c, containing the following functions. int readfile( struct record accarray , int numcust, char filename[ ; int writefile struct record accarrayl , int numcust, char filename Basic s o The function, readfile, will read the data from a text file and store it in the array specified by accarray It must tell the function which called it how many records it has stored into the array. o The function, writefile, will write the data stored in the array specified by accarray into a text file o The return values will be used to tell whether the functions successfully read/write data. o The size of the array and the name of the text file are assumed to be arbitrary (You cannot specify them in this file) o The functions must not have user VO (printf, scanf, etc). 3. Driver Code o Define the following local variables in the main function struct record bankone [5] int numcustomers; A menu is not required. The user-interface can be very simple, but the output of the program must be clear and self-explanatory and must be definitive proof that the functions work. o o You may get input from the keyboard or hardcode your array in the driver for testing o Please make sure that your test cases can really prove that the functions work. (Check if your test case could provide the same results even if they dont work.) The driver code must be written in different c file(s) rather than iofunctions.c o
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started