title: Reading a file through STDIN in C
body: <p>I am trying to run the following in <code>cmd</code>:</p>
  
  <pre><code>gcc my_mainFile
  </code></pre>
  
  <p>and then run the following:</p>
  
  <pre><code>a.exe 2 &lt; file.ppm
  </code></pre>
  
  <p>Basically what it does is sees the value <code>2</code>, calls a specific function based on that, and uses the contents inside the <code>ppm</code> file. However, I am unaware of how to access this file itself. I need to be using <code>scanf()</code> to read the file, but I don't have the format clear. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(int argc, char *argv[]) {
      if(*argv[1] - '0' == 2){
          //Open and read contents of the file
      }
  }
  </code></pre>