Question: 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: C Programming I am trying to get a program that will create And the struct needs to have this information a temporary struct that reads information from a command line argument file

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) return

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!