title: using read system call after a scanf
body: <p>I am having a confusion regarding the following code,</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  int main()
  {
   char buf[100]={'\0'};
   int data=0;
   scanf("%d",&amp;data);
   read(stdin,buf,4);         //attaching to stdin
   printf("buffer is %s\n",buf);
  
   return 1;
   }
  </code></pre>
  
  <p>suppose on runtime I provided with the input <code>10abcd</code> so as per my understanding following should happen:</p>
  
  <ol>
  <li>scanf should place <code>10</code> in data</li>
  <li>and <code>abcd</code> will still be on the stdin buffer</li>
  <li>when read tries to read the stdin (already <code>abcd</code> is there) it should place the <code>abcd</code> into the <code>buf</code></li>
  <li>so printf should print <code>abcd</code></li>
  </ol>
  
  <p>but it is not happening ,printf showing no o/p</p>
  
  <p>am I missing something here?</p>