title: read() and write() sending excess output to Vim
body: <p>I'm using <code>read()</code> and <code>write()</code> syscalls to get input from <code>stdin</code> and print it back to <code>stdout</code>. </p>
  
  <p>From inside Vim I exeute the command to run my program</p>
  
  <pre><code>:!./lowio
  </code></pre>
  
  <p>The buffer array then gets printed out, however the discarded chars that didn't get put into my array are sent to Vim. Vim then interperts the chars as a command.</p>
  
  <pre><code>#include &lt;unistd.h&gt;
  #define BUFSIZE 3
  
  int main()
  {
    char low[BUFSIZE + 1];
    read(0, low, BUFSIZE);
    low[BUFSIZE + 1] = '\0';
    write(1, low, BUFSIZE);
  
   return 0;
  }
  </code></pre>
  
  <p>For example, typing </p>
  
  <pre><code>abcdG
  </code></pre>
  
  <p>Will print <code>abc</code> to <code>stdin</code> but will send <code>dG</code> to Vim which goes and deletes from my cursor to the end of the file.</p>
  
  <p>What is going on here?</p>