Code:
#include <stdio.h>
main() {
FILE *fp;
char filename[81];
double line[9], i = 0;
fp = fopen("payrates.dat", "r");
if (fp == NULL)
printf("Cannot open %s\n", filename);
else {
do {
i++;
fscanf(fp, "%lf\n", &line[i]);
printf("%.2lf ", line[i]);
} while (i != 10);
/*do {
printf("Enter a line: ");
gets(line);
if (line[0] != '\0')
fprintf(fp,"%s\n", line);
} while (line[0] != '\0');*/
fclose(fp);
}
printf("\n%.2lf", line[3]);
/*i = 2 * line;*/
}
ya the ampersand works, but i need it to store the numbers in the file into an array now