DIR *directory; struct dirent *files; char folderPath[] = "//home//unix//20//"; // Make sure I can open the folder "test" otherwise throw an error if ((directory = opendir(folderPath)) == NULL) { printf("\nCouldn't Open Folder!\n"); return 0; } // Loop around and check if the directory is another directory int i = 0; while ((files = readdir(directory)) != NULL) { //printf("%s\n", files->d_name); if (files->d_name i++; } printf("\n");
d_type & DT_DIR
stat()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)