| 12
 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
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 
 |  void afficherlisteprescription()
{
    FILE *f;
    FILE *f1;
    patient p ;
   char chemin[]="/home/3omda/gestionpatient.txt";
    char c, c1[256];
    char nom[256] , prenom[256];
    int telephone;
    char cheminpr[]="/home/3omda/";
     char ext[]=".txt",tel[256];
    printf(" donner le nom de patient : \n ");
    clean_stdin();
    scanf("%s",nom);
    printf(" donner le prenom de patient : \n ");
    clean_stdin();
    scanf("%s",prenom);
    printf(" donner le numero de telephone : \n ");
    clean_stdin();
    scanf("%d",&telephone);
    strcat(cheminpr,nom);
    strcat(cheminpr,prenom);
    sprintf(tel,"%d",telephone);
    strcat(cheminpr,tel);
    strcat(cheminpr,ext);
    f=fopen(chemin,"r");
    if(f==NULL)
    {
    printf("erreur ouverture de fichier %s \n ",chemin);
    }
    int exist=0;
    while (fscanf(f,"%s  %s  %d  %d  %s  %d  %d  %d  %d  %d  %d \n",p.nom,p.prenom,&p.telephone,&p.age,p.adresse,&p.rendezvous,&p.annee,&p.mois,&p.jour,&p.heure,&p.minute)!=EOF)
   {
  if ((p.telephone==telephone))
   {
    printf(" le patient existe \n ");
     exist=1;
   }
 }
    fclose(f);
     if (exist==0)
     {
         printf(" erreur le patient n'existe pas !!!! \n ");
     }
     else
     {
     f1=fopen(cheminpr,"r");
    if(f1==NULL)
    {
    printf("erreur ouverture de fichier %s \n ",cheminpr);
    printf("le patient n'existe pas !!! \n");
    }
    while(c!=EOF)
    {
    c=fgetc(f1);
    printf("%c",c);
    }
    fclose(f1);
    }
      printf("\n\n\n appuyer sur une lettre pour retourner au menu: ");
    clean_stdin();
    scanf("%s",c1);
} |