Created
June 12, 2010 03:05
-
-
Save reu/435362 to your computer and use it in GitHub Desktop.
List current directory (aula de introdução a programação)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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