extraction d'un fichier txt dans une structure
Bonjour a tous;
J'ai le code suivant, je souhaite récupérer les trois premières informations de mon fichier txt.
Code:
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
| #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct application
{
char id[10];
char descr [10];
char owner [10];
};
int main()
{
int i=0;
struct application tab[3];
FILE*batch;
batch=fopen("C:\\Documents and Settings\\gacia delamare\\Bureau\\loader_simple.txt","r");
for(i=0;i<3;i++)
{
fgets(batch,"%s\n %s\n %s\n",&tab[i].id,&tab[i].descr,&tab[i].owner);
printf("%s\n %s\ %s\n",tab[i].id,&tab[i].descr,&tab[i].owner);
}
} |
La compilation se passe bien mais cela bug quand je lance.
Auriez vous une explication?