Hello all,
So I have this data input file...
4 Recumbent_Exercise_Bike E C B S -1 -2 3 20.5 27.5 60.0 22.0 3 5
50 Machine_Fly S A W W 30 40 0 15 18 1.8 30.0 10 2
53 Machine_Bicep_Curl S A W W 30 50 0 10 18 3.25 45.0 20 4
487 Yoga_Sun_Salutation F W M N -1 -2 2 1 3 112.0 1200.0 50 2
221 Walk E C N N -1 -2 3 30.0 45.0 60.0 180.0 35 5
488 Yoga_Downward_Dog F W M N -1 -2 2 1 3 20.0 300.0 50 12
138 Crunch S W N N -1 -2 0 20 40 4.2 240 10 10
222 Jog E C N N -1 -2 1 .5 1.25 150.5 5000 15 5
134 Free_Weight_Bicep_Curl S A F W 15 25 0 8 14 4.5 200.0 10 50
135 Free_Weight_Triceps_Curl S A F W 12 20 0 9 12 5.4 200 10 50
9 Treadmill E L S S -1 -2 1 50.0 75.5 59.0 25.0 15 10
6 Ski_Machine E W O R 30 50 3 7.5 12.5 60.0 15.0 12 12
Now, I having difficulties trying to read each line from my input file by using getline.
Another concerns, I'm trying to figure out which string function that I would need to use in order to go through each data that is separated by the white spaces. And then convert it to the correct type.
Here's what I have so far...
Code:
int main( int argc, char *argv[] )
{
int choice, choice_1 = 0;
int index, i, j, bytes_read, end_of_file = 0;
FILE *exercisefile;
struct program exercise = {NULL}; //Declaring a struct of programs called exercise
struct program *head, *new, *current, *previous; //Declaring pointers
my_string = (char *) malloc (struct program + 1);
bytes_read = getline (&my_string, &struct programs, exercisefile);
puts (my_string);