Bon, voila 3 fonction de mon programme. Avec celle d'affichage, quand j'affiche la 1ere, y a aucun probleme, si j'affiche la deuxieme, g des chiffre farfelus. Ci-joint : les sources des 3fonctions et les capture d'ecran de l'affichage.
void ajoutrdv(void){
FILE *FichMED;
FILE *FichRDV;
struct RDV rdv;
int i;
if ((FichRDV = fopen("FichRDV.txt","r+"))!=NULL){
for (i=1;i<4;i++){
rdv.heure = 40-(i*10);
rdv.minute = 40-(i*10);
rdv.numrecord = 0;
fseek(FichRDV,((sizeof(struct RDV))*i),SEEK_SET);
fwrite(&rdv,sizeof(struct RDV),1,FichRDV);
}
}
fclose(FichRDV);
}
void ajoutrdv2(void){
FILE *FichMED;
FILE *FichRDV;
struct RDV rdv;
int i;
if ((FichRDV = fopen("FichRDV.txt","r+"))!=NULL){
for (i=1;i<4;i++){
rdv.heure = i*10;
rdv.minute = i*10;
rdv.numrecord = 0;
fseek(FichRDV,((sizeof(struct RDV))*i),SEEK_SET);
fwrite(&rdv,sizeof(struct RDV),1,FichRDV);
}
}
fclose(FichRDV);
}
void affichagerdv(void){
FILE *FichRDV;
int eof;
struct RDV rdv;
if ((FichRDV = fopen("FichRDV.txt","r+")) != NULL){
fread(&rdv,sizeof(struct RDV),1,FichRDV);
while (!(eof = feof(FichRDV))){
cout<<rdv.heure<<":"<<rdv.minute<<" "<<rdv.numrecord<<endl;
fread(&rdv,sizeof(struct RDV),1,FichRDV);
}
fclose(FichRDV);
}
}
capture d'ecran de ajoutrdv() : ***********************************************
*1 : Cree le fichier medecin *
*2 : Remise a blanc du fichier de rendez-vous *
*3 : Ajouter un medecin *
*4 : Affichage du fichier medecin *
*5 : Ajouter un rendez-vous *
*6 : Afficahge rendez-vous *
*0 : Quitter *
***********************************************
0:0 1
30:30 0
20:20 0
10:10 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
Press any key to continue . . .
capture d'ecran de ajoutrdv2() :
***********************************************
*1 : Cree le fichier medecin *
*2 : Remise a blanc du fichier de rendez-vous *
*3 : Ajouter un medecin *
*4 : Affichage du fichier medecin *
*5 : Ajouter un rendez-vous *
*6 : Afficahge rendez-vous *
*0 : Quitter *
***********************************************
0:0 1
10:10 1310720
1310720:0 1966080
1966080:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
0:0 0
Press any key to continue . . .
Si qq arrive a me resoudre le probleme, je lui paye un verre des que je le voit ;)
Afficher la suite