In the previous section, it is discussed how GetPot handles arguments that follow other arguments on the command line. Popular programs, such as 'gcc' parse information that directly follows a string without any whitespace, such as '-I/usr/local/include/GL'. In this case '-I' indicates that a include path is to be set and the following character chain represents the path to be used. Of course, GetPot provides an easy means to access these strings: the direct_follow()-functions. Example:
...
vector<string> incl_path;
const char* path = cl.direct_follow((const char*)0, "-I");
// read all arguments that start with '-I'
cl.init_multiple_occurrence();
while(path != 0) {
incl_path.push_back(string(path));
path = cl.direct_follow((const char*)0, "-I");
}
...