Skip to content

Instantly share code, notes, and snippets.

@automata
Created April 4, 2011 02:38
Show Gist options
  • Save automata/901074 to your computer and use it in GitHub Desktop.
Save automata/901074 to your computer and use it in GitHub Desktop.
usando opendir para listar diretório
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
int main(void) {
DIR *diretorio;
struct dirent *navegador;
char foo[100];
sprintf(foo, "%s", "nome_do_diretorio");
diretorio = opendir(foo);
while ((navegador = readdir(diretorio)) != NULL) {
printf("%s\n", navegador->d_name);
}
return(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment