Zaibon

Untitled

Aug 4th, 2011
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. short validNomencalture(long number, long pto )
  2. {
  3.     short retour = 1;
  4.     FILE *pf = fopen(F_EXAMEN,"rb");
  5.     Examen *pExam = NULL;
  6.    
  7.     if(pf != NULL)
  8.     {
  9.         if( fseek(pf,pto,SEEK_SET) == 0 &&  (fread(pExam,(long)sizeof(Examen),1,pf)  == 1) )
  10.         {
  11.                 while(retour == 1 && pExam->nomenclature != -1)
  12.                 {
  13.                     if(pExam->nomenclature == number)
  14.                         retour = 0;
  15.                     if(fseek(pf,pExam->offsetSvt,SEEK_SET) != 0 && fread(pExam,sizeof(Examen),1,pf) != 1 )
  16.                         retour = 0;
  17.                 }
  18.         }
  19.          else
  20.                 retour = 0;
  21.       }
  22.    
  23.    
  24.     if(!retour)
  25.         printf("Erreur lecture du fichier %s\n",F_EXAMEN);
  26.    
  27.     return retour;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment