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 30 31 32 33 34 35 36 37 38 39 40
|
void Lecture()
{
int test=0, test2=0, trouve=1;
char *string1, *string2;
temp=0;
f1=fopen(nomfich,"r");
while ((tableau=readdir(dossier))!=NULL)
{
test=strlen(tableau->d_name)+1;
if (test>21)
{
rewind(f1);
tabfich[temp]= malloc(strlen(tableau->d_name)+1);
string1=tableau->d_name;
trouve=1;
while ((fgets(string2,test,f1)!=NULL)&&(trouve!=0))
{
test2=strlen(string2);
if (test2>21)
{
test2=strncmp(string1, string2, test-1);
if (test2==0)
{
trouve=0;
}
}
}
if (trouve!=0)
{
ouinon=1;
tabfich[temp]=string1;
temp++;
}
}
}
fclose(f1);
free(string1);
free(string2);
} |
Partager