I am trying to parse a text file into variables for x1, y1, x2 and y2 but when I print the variables to check if they have been updated to the new values and they are all 0.000000.
Sample line from the txt file is "W 0.2 0.1 0.2 0.2" formatted as "command x1 y1 x2 y2".
void draw_walls(FILE *stream)
{
while (!feof(stream))
{
char command;
// Declare variables
double wall_x1, wall_y1, wall_x2, wall_y2;
int wall_count = fscanf(stream, "%c %lf %lf %lf %lf", &command, &wall_x1, &wall_y1, &wall_x2, &wall_y2);
printf("%c %lf %lf %lf %lf", command, wall_x1, wall_y1, wall_x2, wall_y2);
}
}
printf should return "W 0.2 0.1 0.2 0.2"
currently only returns " 0.000000 0.000000 0.000000 0.000000"