Skip to content

Instantly share code, notes, and snippets.

@cashiwamochi
Last active June 15, 2018 06:50
Show Gist options
  • Save cashiwamochi/ee019676bc04411450ba1eec8f2f8c22 to your computer and use it in GitHub Desktop.
Save cashiwamochi/ee019676bc04411450ba1eec8f2f8c22 to your computer and use it in GitHub Desktop.
#include <dirent.h>
vector<string> readFileInDir(char* path_to_image) {
vector<string> paths;
DIR* dp=opendir(path_to_image);
string s_path_to_image = path_to_image;
if (dp!=NULL)
{
struct dirent* d;
do{
d = readdir(dp);
if (d!=NULL) {
string file_name = d->d_name;
paths.push_back(s_path_to_image + file_name);
}
}while(d!=NULL);
}
closedir(dp);
return paths;
}
@cashiwamochi
Copy link
Author

path[0]とpath[1]には,"your_path/."と"your_path/.."が入る( どの環境でも? )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment