#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include<conio.h>
int main(void) {
DIR *d;
struct dirent *dir;
char *directory_path = " "; // "." refers to the current directory
clrscr();
printf("\nEnter path of the directory...!\n");
printf("\For example: 'C:/TURBOC3/SOURCE' :\n");
scanf("%s",directory_path);
d = opendir(directory_path);
if (d) {
while ((dir = readdir(d)) != NULL) {
printf("%s\n", dir->d_name);
}
closedir(d);
} else {
perror("Unable to open directory");
return EXIT_FAILURE;
}
getch();
return EXIT_SUCCESS;
}