tichadok
Messages postés2Date d'inscriptionlundi 7 juillet 2003StatutMembreDernière intervention 6 juin 2005
-
5 juin 2005 à 23:56
tichadok
Messages postés2Date d'inscriptionlundi 7 juillet 2003StatutMembreDernière intervention 6 juin 2005
-
6 juin 2005 à 14:48
Bonjour,
voici mon problème condensé dans ce bout de code :
un fichier fic.txt contient :
2.0
3.0
un fichier lect.c contient :
#include <stdio.h>
int main(void){
int nb_lus;
float ech;
FILE *son;
son = fopen("fic.txt","r");
nb_lus=fscanf (son,"%d",&ech);
while (nb_lus==1){
printf("%f\n",ech);
nb_lus=fscanf (son,"%f",&ech);
}
return 0;
}
et voici l'affichage une fois compilé :
0.000000
0.000000
3.000000
alors que je m'attends à avoir l'affichage suivant: