Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C Programming I am trying to get a program that will create a temporary struct that reads information from a command line argument file into
C Programming
I am trying to get a program that will create a temporary struct that reads information from a command line argument file into a temporary struct and then passes that information to a function that adds it to the end of a dynamically allocated list, and repeats until the end of the file is reached.
My current function to get the info from the command line argument file looks like this: And the struct needs to have this information
Thank you
int buildEmployeeList (struct employee listl, char* filename) { "r"); FILE * f= fopen (filename, if (f NULL) return-1 ; int i = 0; while(!feof (f) &&ferror (E)) struct employee temp; int num = fscanf(f, "%s %d %lf %1f ", temp . name , if (num 4) &temp.id, &temp .hoursworked, &temp.hourlyRate ); printf ("Didn't read enough values from input file line %d " , i); list[i++ tempi fclose (E) returnStep 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