title: Using setvbuf() with STDIN stream
body: <p>I’m writing a small C program that must accept an input stream larger than 4096 bytes.</p>
  
  <p>I did find a post that recommended using <strong>setvbuf()</strong> here:</p>
  
  <p><a href="https://stackoverflow.com/q/3612363">Making fgets issue longer read() calls on linux</a></p>
  
  <p>I’m still having a really hard time getting this to work – here’s the bit of my code that I’m struggling with:</p>
  
  <pre><code>int main(void) 
  { 
  #define MAX_STRING_SIZE 7168
  
  char input_string[MAX_STRING_SIZE];
  
  printf( "Input: " );
  
  setvbuf( stdin, NULL, _IONBF, 0 );
  
  fgets( input_string, MAX_STRING_SIZE-1, stdin );
  
  printf( "\n" );
  printf( "%s", input_string );
  } 
  </code></pre>
  
  <p>Has anyone had success increasing this input buffer?</p>
  
  <p>My environment: Ubuntu 10.10 with the build-essential package</p>
  
  <p>Thanks!</p>