title: C - reading integers from stdin using read()
body: <p>I'm learning C and I don't understand the behavior of the code below:</p>
  
  <pre><code>#include &lt;sys/types.h&gt;
  #include &lt;sys/uio.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;stdio.h&gt;
  
  int main() {    
      int buffer;
      read(0, &amp;buffer, sizeof(int));
      printf("%d", buffer);
      return 0;
  }
  </code></pre>
  
  <p>Input:</p>
  
  <pre><code>1
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>2609
  </code></pre>
  
  <p>What's going on here? Shouldn't the output be 1?</p>