title: New to <dirent.h>, trying to access data in a directory
body: <p>I've never used <code>dirent.h</code> before. I was using istringstream to read through text files (singular), but have needed to try to revise the program to read in multiple text files in a directory. This is where I tried implementing dirent, but it's not working. </p>
  
  <p>Maybe I can't use it with the stringstream? Please advise.</p>
  
  <p>I've taken out the fluffy stuff that I'm doing with the words for readability. This <em>was</em> working perfectly for one file, until I added the dirent.h stuff.</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;sstream&gt;  // for istringstream
  #include &lt;fstream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;dirent.h&gt;
  
  void main(){
  
      string fileName;
      istringstream strLine;
      const string Punctuation = "-,.;:?\"'!@#$%^&amp;*[]{}|";
      const char *commonWords[] = {"AND","IS","OR","ARE","THE","A","AN",""};
      string line, word;
      int currentLine = 0;
      int hashValue = 0;
  
      //// these variables were added to new code //////
  
      struct dirent *pent = NULL;
      DIR *pdir = NULL; // pointer to the directory
      pdir = opendir("documents");
  
      //////////////////////////////////////////////////
  
  
      while(pent = readdir(pdir)){
  
          // read in values line by line, then word by word
          while(getline(cin,line)){
              ++currentLine;
  
              strLine.clear();
              strLine.str(line);
  
              while(strLine &gt;&gt; word){
  
                          // insert the words into a table
  
              }
  
          } // end getline
  
          //print the words in the table
  
      closedir(pdir);
  
      }
  </code></pre>