title: Freopen Multiple File input - C++
body: <p>I have tried this </p>
  
  <pre><code>...
  for(int i=0;i&lt;totalDoc;i++){
          freopen(name[i],"r",stdin);
          while(cin&gt;&gt;s!=NULL){doc[i]=doc[i]+s+" ";}
          fclose(stdin);
          ...
  }
  </code></pre>
  
  <p>with <code>name</code> is a char "doc1.txt", "doc2.txt", ...</p>
  
  <p>but, this code only open "doc1.txt", can somebody help me please?</p>