title: Read a string of length greater than 4096 bytes from stdin in C++
body: <p>I am trying to read in a string of length in 10^5 order. I get incorrect string if the size of string grows beyond 4096.
  I am using the following code </p>
  
  <pre><code>string a;
  cin&gt;&gt;a;
  </code></pre>
  
  <p>This didn't work then I tried reading character by character by following code</p>
  
  <pre><code>unsigned char c;
  vector&lt;unsigned char&gt; a;
  while(count&gt;0){
   c = getchar();
   a.push_back(c);
   count--;
  }
  </code></pre>
  
  <p>I have done necessary escaping for using <code>getchar</code> this also had the 4096 bytes problem. Can someone suggest a workaround or point to correct way of reading it.</p>