Question: I need to write a C program that reads 4 items of information from a text file and stores them into a constant array of
I need to write a C program that reads 4 items of information from a text file and stores them into a constant array of structs of size 4.
The structure definition is as follows:

I need to use fscanf that reads 4 entries of data in a text file. Each entry consists of an integer, string, double, and double. Each data component is separated by \t, so I need the fscanf function to read tab delimited data.
I know how to write the code to open the text file to be read, but I'm not sure about how to write the fscanf function to read the data from the text file into an array of structs.
After the data items from the text file are stored in the array of structs, I then need to write them out to a binary file.
Thanks in advance
tifndef #define PROGRAM-6-P6-STRUCT_A PROGRAM 6 P6-STRUCT-H typedef struct t int itenid char description [40]; double manCost; double sellPrice; ItemInfo #endif //PR0GRAM-6.P6STRUCT.H
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
