Created
December 27, 2015 09:41
-
-
Save MizukiSonoko/e4a654e8aaf1843b695e to your computer and use it in GitHub Desktop.
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 <string> | |
#include <iostream> | |
#include <vector> | |
#include <dirent.h> | |
using namespace std; | |
vector<string> files; | |
void load(string directory,string filename){ | |
if(filename == "." || filename == "..") return; | |
if(filename!="") | |
directory += "/" + filename; | |
DIR* dir = opendir(directory.c_str()); | |
if(dir!=NULL){ | |
struct dirent* dent; | |
dent = readdir(dir); | |
while(dent!=NULL){ | |
dent = readdir(dir); | |
if(dent!=NULL) | |
load(directory, string(dent->d_name)); | |
} | |
closedir(dir); | |
}else{ | |
files.push_back(directory); | |
} | |
} | |
int main(int argc, char* argv[]){ | |
load("public",""); | |
for(auto v : files){ | |
cout<< v <<endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment