hmmm I copied your code and made it into a main function so I could run it, and its working fine. I added some printf's so i could see if it was working correctly, and it seemed to be. here's the code I have:
Code:
#include <stdio.h>
int main()
{
int i=0;
double temp;
FILE *filedata;
int num_temps;
double temps[100];
filedata = fopen("c:\\labdata.txt","r");
if(filedata == NULL)
{
printf("Error opening file.\n");
} else {
while ((fscanf(filedata,"%lf ",&temp)) == 1)
{
temps[i] = temp;
printf("%g\n", temps[i]);
i++;
}
}
fclose(filedata);
num_temps = i;
printf("%d numbers in the file.\n", num_temps);
return 0;
}