1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define taille 31
void main()
{
FILE* fichEmp;
fichEmp=fopen("./info.txt","r");
char tmpNom[taille]="";
char tmpPoste;
float tmpTauxH, tmpHeureS;
if(fichEmp==NULL)
{
printf("impossible d'ouvrir le fichier");
exit(1);
}
else
{
while(fgets(tmpNom,30, fichEmp )!= NULL)
{
fscanf(fichEmp, " %c %f %f\n", &tmpPoste, &tmpTauxH, &tmpHeureS ); // Ici avant le "%c tu mets un espace comme dans l'exemple.
printf("**** %s\n", tmpNom);
printf("-----%c %f %f\n", tmpPoste, tmpTauxH, tmpHeureS);
}
}
fclose(fichEmp);
} |