J
jj_76
Hello,
I have the following code and I try to read data from a file. But all I
get are zero's. Any help is appreciated.
--------------------------------
#include <stdio.h>
#include <math.h>
main()
{
double mtot;
FILE *fp1;
FILE *fp2;
fp1=fopen("initial_birth","r");
while(!feof(fp1))
{
fscanf(fp1,"%f",&mtot);
printf("%f\n",mtot);
}
fclose(fp1);
fclose(fp2);
}
-----------------------
I have the following code and I try to read data from a file. But all I
get are zero's. Any help is appreciated.
--------------------------------
#include <stdio.h>
#include <math.h>
main()
{
double mtot;
FILE *fp1;
FILE *fp2;
fp1=fopen("initial_birth","r");
while(!feof(fp1))
{
fscanf(fp1,"%f",&mtot);
printf("%f\n",mtot);
}
fclose(fp1);
fclose(fp2);
}
-----------------------