i've a function to list all file in a dir:
Code: Select all
n = scandir(dir, &namelist, 0, alphasort);
b=n;
while(b--){
if(a!=n){
a++;
printf("%s\n", namelist[a]->d_name);
}
}
I will show only the name of the file, not the "." and ".."!
Code: Select all
if ((strcmp(namelist[a]->d_name,".") == 0)
....
( Excuse me for my english, i'm italian )