Answered step by step
Verified Expert Solution
Link Copied!

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: image text in transcribed And the struct needs to have this information image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions