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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
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<list1 value1><d> <list1 value2><d> ... <d><list1 valueX1><cr>...<listN value1><d><listN value2><d> ... <d><listN valueXN><cr><eof>Where <d> is a delimiter character that would not occur naturally in a name like : '~' and<cr> is the newline character that pico inserts when you press the ENTER key to advance to a newline.<eof> is the end of file character that pico inserts when you save / close the file.Hint:Binary file (file.b) format:<list1 len><list1 val1> ... <list1 valX1> ... <listN len><listN val1> ... <listN valXN><eof>
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY