lire le contenu d un repertoire comme la commande ls
j aimerais juste enlever les warnings
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
int my_ls(struct dirent *direct)
{
DIR *dir;
char res;
dir = opendir(direct);
while ((direct = readdir(dir)) != NULL)
{
if ((strncmp(direct->d_name, ".", 1)))
puts(direct->d_name);
}
closedir(dir);
return (0);
}
int main(int ac, char **av)
{
if (av[1] && ac > 1)
my_ls(av[1]);
return (0);
} |
bien sur il n est pas fini
mais je veux enlever :
Code:
1 2 3 4 5
|
my_ls2.c: In function `my_ls':
my_ls2.c:22: warning: passing arg 1 of `opendir' from incompatible pointer type
my_ls2.c: In function `main':
my_ls2.c:35: warning: passing arg 1 of `my_ls' from incompatible pointer type |