Please refer to the code below.It is used to extract files from a given directory, for further processing.
include <dirent.h>
include <stdio.h>
include <string.h>
int main(void)
{
int i=0;
struct dirent *direntry;
dir = opendir("E:/muzikk");
if(!dir)
{
printf("Error: directory did not open!\n");
return 1;
}
while((direntry=readdir(dir))!=NULL)
{
printf("%d %s\n",i,direntry->d_name);
i++;
}
closedir(dir);
return 0;
}
The problem is,that on running, it returns the first two file names as '.'(on zero position) and '..'(on first position), which is undesirable. can anyone explain or help. thanks.