title: How to take a look at the next character in a stream in C?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2082743/c-equivalent-to-fstreams-peek">C equivalent to fstream&#39;s peek</a>  </p>
  </blockquote>
  
  
  
  <p>Say I have a file with characters in it. I want to look at what the next character is without moving the pointer, just to "peak" at it. how would I go about doing that?</p>
  
  <pre><code>FILE *fp;
  char c, d;
  
  fp = fopen (file, "r");
  
  c = getc(fp);
  
  d = nextchar?
  </code></pre>
  
  <p>How do I look at the character that comes next without actually calling getc again and moving the pointer?</p>