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
|
...
int nb_lignes = 1;
char ligne_lue[512];
int stop = 0;
char prefix[11] = " *PRE*";
while(fgets(ligne_lue, 512, f) != NULL && !stop && nb_lignes<=3){
printf("ligne_lue = %s\n", ligne_lue);
switch (nb_lignes) {
case 1:
if(strncmp(ligne_lue, prefix, 11) != 0)
stop = 1;
break;
case 2:
if(strncmp(ligne_lue, prefix, 11) !=0)
stop = 1;
else
{
/* vérifier que la deuxième ligne
* commence par la chaine "prefix"
* puis extraire la signature */
char signature[512] = "";
int i = 11;
while(ligne_lue[i] != ' ')
{
sprintf(signature,"%s%c", signature, ligne_lue[i]);
i++;
}
old_hash = strdup(signature);
}
break;
....
}
nb_lignes++;
}
... |
Partager