For this assignment, you need only write a single-file C program. Your program will:Define a C structure ( sample struct )suitable to hold the defining characteristics of a:Sample (int list_len,...






For this assignment, you need only write a single-file C program. Your program will:Define a C structure ( sample struct )suitable to hold the defining characteristics of a:Sample (int list_len, float * value_list) - call this format a Sample data record.Write a separate function to :Read a file of delimited Sample data records into an array of pointers to your sample structs. Note: you may use a statically sized array of size 1024, however, each element of the array must be a pointer to a sample struct (as defined above). Initially each element of the array must be set to NULL (to indicated that it is not used), and then later to a dynamically allocated sample struct if it is to be used. Note: after dynamically allocating memory for a sample struct, you have enough memory for each/every component of the structure. However, for each component of that structure that is a pointer, you will eventually need to allocated memory for the “thing” that it points to as well (think array via float*). You will also have to remember this when freeing memory via a pointer to a sample struct.Write a separate function to :Create a new file and write all the “used” elements of the array ( of sample struct s ) to this file. You must use binary writes for all of C's built-in numeric types.Write a separate function to :Free all of the “used” elements of the array ( of sample struct s ) – that means all the memory that was allocated for each element ( the structure and its components ).Write a separate function to :Read a file of your sample struct s, ( as it was created by your second function ) and display each in a reasonable report like format to the screen.






















Note:You will need to create a text file of of delimited Sample data records in an editor like pico in order to test / run your program. file.txt ... ... ... Where is a delimiter character that would not occur naturally in a name like : '~' and is the newline character that pico inserts when you press the ENTER key to advance to a newline. is the end of file character that pico inserts when you save / close the file.Hint:Binary file (file.b) format: ... ... ...




Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here