I need to read certain columns of a data file for certain lines only. I have used the structure to read the files but I am getting problem with it. I don't have any errors but the main problem is that the data are read but all with null values. I know I should copy the data but don't know how. So please help me out.
Code:
typedef struct{
int Time;
float DryTempC, DewPointC;
int RH;
}MONTH;
MONTH month[240];
void read_data();
int main()
{
read_data();
}
void read_data()
{
int i;
int Jday;
FILE * pFile;
pFile = fopen ("KBIS_2005.txt","r");
printf("HD\t""T20\t""VPD05\t""TR2RH70\n\n");
for(i=0;i<=239;i++)
{
fscanf(pFile,"%d\t""%f\t""%f\t""%d\t\n",&month[i].Time, &month[i].DryTempC, &month[i].DewPointC,&month[i].RH);
printf("%3d\t""%4.1f\t""%4.1f\t""%3d\n",month[i].Time, month[i].DryTempC, month[i].DewPointC, month[i].RH);
}
fclose(pFile);
}.
and the file is something like
Time DewPointC DryPointc RH
0 0.6 -5 67
1 0 -3.9 75
2 0 -3.9 75
3 0 -3.9 75
4 0 -4 75