i'm trying to open a read a file that i wrote in notepad...it's a series of tables...four columns w/ five numbers in each...it should be rather simple but i can't even get it to read anything....even the first 5 floating values...let alone the whole database...and exit(1) will not work in a VMS system...but i can't figure out what else will....if anyone has any insight it's much appreciated...
#include <string.h>
void main (void)
{
FILE *in_file;
int i;
float val, n;
in_file = fopen("program.txt","r"); /*trying to open file*/
if (in_file == (FILE *) NULL)
{
printf("\nFailed to open the data file.\n");
exit(1);
}
printf("\nThe file has been successfully opened for reading.\n");
for (i = 1; i <= 5; i++)
{fscanf(in_file,"%0.2f %f", &n, &val);
printf("\n%0.2f %f", n, val);}
fclose(in_file);
}