I need to print .c files, executables, and directories in seperate color. Please suggest me some ideas. Thanks in advance
int main(void)
{
DIR *d;
int iNum = 0;
struct dirent *dir;
char *ptr = ".";
char *ptr1 = "..";
d = opendir(".");
if (d)
{
while ((dir = readdir(d)) != NULL)
{
if(strcmp(ptr,dir->d_name) && strcmp(ptr1,dir->d_name))
{
printf("%d\n", dir->d_type);
printf("%s\n", dir->d_name);
iNum++;
}
}
closedir(d);
}
printf("the number of files are %d\n",iNum);
return(0);
}