Bonjour,
comment faire pour rechercher chaine de caractère dans une structure en langage c?
quand il n'y a aucun pays ça fonctionne mais dés que j'en encode un puis que je le recherche, il me dit qu'il n'a pas pu être trouvé.
voici mon code:
short RechercheParNom (struct Pays*p) //par pays
{
int j,i;
short trouve=0;
char NomPays[30];
printf("Recherche d'un Pays\n");
printf("________________________\n\n");
printf("Entrez le nom a rechecher : ");
j=LireVChaine(NomPays,30);
Majuscule(&NomPays[0]);
for(j=0;j<30 && trouve==0;j++,i++)
{
if(strcmp(p->NomPays,NomPays)==0)
{
trouve=1;
}
}
if(j==30 && trouve==0)
j=0;
if (trouve==1)
{
AffichePays(p);
}
else
{
printf("\nLe Pays recherche n'a pu etre trouve");
}
return (j-1);
}Configuration: Windows XP Firefox 2.0.0.13
