Search code examples
c++eclipse-cdt

Eclipse CDT: passing multiple program arguments with same file extension


I want to input a bunch of image files from the same folder and apply them the same operation inside a for-loop. I defined main as int main(int argc, char** argv) have this for-loop:

for(int i=1; i < argc; ++i)
{
   // do something here
}

In Eclipse CDT (Neon), under Run configurations > Arguments, I'm entering the paths of images that I want to process. It works when I explicitly give a list of images like img1.jpg img2.jpg ... however it doesn't work when I give try to run it on all the image files with a certain extension such as dataset/*.jpg.

Is there a workaround for this? Thanks.


Solution

  • Is there a workaround for this?

    The two most obvious ones that come to mind are:

    1. Run the program from a terminal instead of from inside Eclipse.
    2. Modify the program to take just the directory name as the argument, and have it iterate over the files in the directory.