globbing.h
Go to the documentation of this file.
1 // To glob. Or not to glob? What a stupid question.
2 
3 
4 
5 #ifndef globbing_h
6 #define globbing_h
7 
8 
9 
10 #include <glob.h>
11 #include <vector>
12 #include <string>
13 
14 
15 
16 inline std::vector<std::string> globbing(const std::string& pat){
17 
18  glob_t glob_result;
19  std::vector<std::string> ret;
20 
21  glob(pat.c_str(),GLOB_TILDE,NULL,&glob_result);
22 
23  for (unsigned int i=0; i<glob_result.gl_pathc; ++i){
24  ret.push_back(std::string(glob_result.gl_pathv[i]));
25  }
26 
27  globfree(&glob_result);
28 
29  return ret;
30 }
31 
32 
33 
34 #endif
std::string string
Definition: nybbler.cc:12
std::vector< std::string > globbing(const std::string &pat)
Definition: globbing.h:16