- // trouver un caractere specifique dans une chaine de caracteres ///////////////
-
- typedef char chaine[200];
- chaine string;
- char *ptr,c;
- c='<'; // donc ici on cherche le caractere <
- strcpy(string, Ligne d'exemple <14> 54613134 hophop);
- ptr=strchr(string,c);
-
- if (ptr != NULL)
- {
- printf("le caractere %c est a la position %d",c,ptr-string);
- }
- else
- {
- printf("not found");
- }
-
// trouver un caractere specifique dans une chaine de caracteres ///////////////
typedef char chaine[200];
chaine string;
char *ptr,c;
c='<'; // donc ici on cherche le caractere <
strcpy(string, Ligne d'exemple <14> 54613134 hophop);
ptr=strchr(string,c);
if (ptr != NULL)
{
printf("le caractere %c est a la position %d",c,ptr-string);
}
else
{
printf("not found");
}