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
|
FILE*lireaeroports = (FILE*)NULL;
char line [LINELENGH]; char cellule [CELLLENGH];
int debcell=0; int fincell=0; int nbcell=0;
lireaeroports = fopen("FichierAeroport.csv", "r");
if (!lireaeroports) {fprintf(stderr,"Le fichier FichierAeroport.csv n'est pas dans la racine du répertoire.");}
char *separateur = { ";" };
char *pcourant;
char *buffer;
while((fgets(line,LINELENGH,lireaeroports))&&(strcmp(line,";;;\n")))
{
buffer = strdup (line);
pcourant = strtok(buffer, separateur);
listeaeroport[i].nompays = *pcourant
while( pcourant != NULL )
{
// Cherche les autres separateur
pcourant = strtok( NULL, separateur );
if ( pcourant != NULL )
{
//nb_mot++; // increment du nombre de mot
listeaeroport[i].nomville = *pcourant
// comment stocker tt les champs ? distance et autre ?
}
}
i++; |
Partager