Código C:
Ver original
#include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <sys/param.h> #include <dir.h> int main(int argc, char *argv[]) { FILE *ptr; struct dirent *dir, *dirp; char nombre [ MAXPATHLEN ], **carpetas, nom [ 100 ]; int x = 0; getcwd ( nombre, MAXPATHLEN ); if ( ( dir = opendir ( nombre ) ) == NULL ) { } else { for ( dirp = readdir ( dir ); dirp != NULL; dirp = readdir ( dir ) ) { carpetas [ x ] = dirp->d_name; ++x; } for ( x = 0; carpetas [ x ] != NULL; x++ ) { } } return 0; }