Skip to content

Instantly share code, notes, and snippets.

@reu
Created June 12, 2010 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reu/435362 to your computer and use it in GitHub Desktop.
Save reu/435362 to your computer and use it in GitHub Desktop.
List current directory (aula de introdução a programação)
#include <stdio.h>
#include <dirent.h>
#include <sys/types.h>
int main (void)
{
DIR *directory;
struct dirent *current_file;
if(directory = opendir("./")){
while(current_file = readdir(directory)){
puts(current_file->d_name);
}
closedir(directory);
}
else
"Ops..."
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment