title: Opening files with while loop - C
body: <p>Hello fellow programmers. 
  I have little problem. I cannot figure out how to open files with different numbers (in the filename) going from 1 to whatever number of files exist.</p>
  
  <p>For example, I have two (or eventually <em>n</em>) files named <code>game_1.txt</code> and <code>game_2.txt</code>. This loop should open these two files (or eventually all with this pattern, in that folder). </p>
  
  <p>I am getting errors, namely:</p>
  
  <blockquote>
    <p>passing argument 2 of 'fopen' makes pointer from integer without a
    cast.</p>
  </blockquote>
  
  <p>Here is what I have:</p>
  
  <pre><code>main()
  {
      FILE *fr;
      int i=1;
      char b;
  
      while(fr=fopen("game_%d.txt",i) != NULL)
      {
          while(fscanf(fr,"%c",&amp;b) &gt; 0)
          {
              printf("%c",b);
          }
          i++;
      }
  
  
      return 0;
  }
  </code></pre>