title: Read all files from a folder c++
body: <p>I am having a program which reads images from a folder. I am using a for to access all the index of the files and store them into a vector:</p>
  
  <pre><code>    for(int i=0; i&lt;labels.size(); i++){
  
      ostringstream stringStream;
      stringStream &lt;&lt; setfill ('0') &lt;&lt; setw (4) &lt;&lt; i;
      num2string = stringStream.str();
  
      string img = "C:\\opencvAssets/detected/BioID_"+num2string+".pgm";
      //cout&lt;&lt; img &lt;&lt;" \n";
      images.push_back(imread(img, CV_LOAD_IMAGE_GRAYSCALE));  //labels.push_back(i);
  }
  </code></pre>
  
  <p>I am having some troubles, since some of the files delibrately is missing from the folder. Thus, for approach is prohibitive. How can I read all the files and store them into a vector??</p>