THis is some code I was writing to open a txt file and read the numbers in. It compiles fine but when I run it the console only comes up for a split second and then disappears again. If anyone wants to look over it and post back a solution it would be greatly appreciated. I am trying to read in 5 numbers form a txt file hence the f1....f5.
/* Reading formatted file data with fscanf(). */
if ((fp=fopen("input.txt", "r"))==NULL)
fprintf(stderr, "Error opening the file.\n");
fscanf(fp, "%f %f %f %f %f", &f1,&f2,&f3,&f4,&f5);
printf(" The values are %f,%f,%f,%f, and %f\n.", f1,f2,f3,f4,f5);