Hi, thanks for the suggest, this does not work more
Code:
#include <stdio.h>
#include <string.h>
/*file format
nom1:PATRICK DUCHMOL:S:2:4:3:30:0
nom2:HERVE DUCHMOL DE LA POTEE::1:9:6:20:9
*/
int main()
{
FILE * fd = NULL ;
char chaine [200];
char flag [5];
char nom[50];
char s[2] ;
int st1 ;
int st2 ;
int st3 ;
int po ;
int ti ;
if((fd=fopen("./file.txt", "r"))==NULL) {
printf("Error\n") ;
}
char buff[BUFSIZ];
while ( fgets(buff,BUFSIZ,fd) != NULL ) {
printf("%s",buff);
if ( sscanf(buff, "%s:%[^:]:%s:%d:%d:%d:%d:%d", flag, nom, s, &st1, &st2, &st3, &po, &ti) == 8) {
printf("%s",nom);
}
}
}