title: How to call fgets in x86 assembly?
body: <p>According to <a href="http://www.cplusplus.com/reference/clibrary/cstdio/fgets/" rel="nofollow noreferrer">the documentation for <code>fgets()</code></a>, the function takes three parameters:</p>
  
  <ul>
  <li><strong>char *</strong> - a string that will hold the input</li>
  <li><strong>int</strong> - an integer that represents the maximum number of characters to read</li>
  <li><strong>FILE *</strong> - a <code>FILE *</code> to the stream to read from</li>
  </ul>
  
  <p>I have no trouble calling the function. I just <code>push</code> the three parameters onto the stack, call the function, and increase <code>ESP</code> by 12.</p>
  
  <p>My problem is with parameter #3. What should be passed in as the <code>FILE *</code> for standard input? In C, I can just use <code>stdin</code>, but I don't know what the equivalent is in x86 assembly.</p>
  
  <hr>
  
  <p><strong>Update:</strong> I'm using NASM on Linux.</p>