title: How can i open certain file's automatically in c++
body: <p>I'm try to open certain file automatically in c++. File's title is same but only different file's number. </p>
  
  <blockquote>
    <p>like this  ' test_1.txt test_3.txt test_6.txt ... '</p>
  </blockquote>
  
  <p>These numbers are not listed in regular sequence.</p>
  
  <p>And here is my code</p>
  
  <p>`</p>
  
  <pre><code>#include &lt;fstream&gt;
  #include &lt;sstream&gt;
  #include &lt;string&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main(){
      int n[20]= {4,7,10,13,16,19,21,24,27,30,33,36,39,42,45,48,51,54,57,60};
      ifstream fp;
      ofstream fo;
      fp.open(Form("test%d.txt",n));
  
  
  char line[200];
  if(fp == NULL)
  {
      cout &lt;&lt; "No file" &lt;&lt; endl;
      return 0;
  }
  if(fp.is_open())
  {
      ofstream fout("c_text%d.txt",n);
      while (fp.getline(line, sizeof(line)))
      {
          if(line[4] == '2' &amp;&amp; line[6] == '4')
          {
              fout&lt;&lt;line&lt;&lt;"\n";
  
          }
      }
      fout.close();
  }
  fp.close();
  return 0;
  }`
  </code></pre>
  
  <p>Now, Function 'Form' doesn't work. and I don't have another idea.
  If you have any comment or idea, please tell me.
  Thank you!</p>