I tried to reading this file and write in struct musteri until 'E'.But this doesnt work correctly can you help me?
Code:
#include<stdio.h>#include<stdlib.h>
#include<string.h>
struct musteri{
float id[10];
float x1[10];
float x2[10];
float x3[10];
float x4[10];
float x5[10];
}musteri;
int main() {
char harf;
int i=0;
int ch;
FILE *d;
d=fopen("d.txt","r");
while ((harf=fgetc(d)) != 'E'){
fscanf(d," %f %f %f %f %f %f ",&musteri.id[i],&musteri.x1[i],&musteri.x2[i],&musteri.x3[i],&musteri.x4[i],&musteri.x5[i]);
i++;
}
ch=i;
i=0;
for(i=0;i<ch;i++){
printf("%f %f %f %f %f %f",musteri.id[i],musteri.x1[i],musteri.x2[i],musteri.x3[i],musteri.x4[i],musteri.x5[i]);
printf("\n\n\n");
}
return 0;
}