title: Reading in standard input into a char array - C++
body: <p>I'm wondering what is the accepted way of getting input from the command line which captures white space as well.  I thought this would do it...</p>
  
  <pre><code>char text[500];   
  int textSize = 0;
  
  int main() {
  
      while (!cin.eof()) {
          cin &gt;&gt; text[textSize];
          textSize++;
      }
  
      for(int i = 0; i &lt; textSize; i++) {
          cout &lt;&lt; text[i];
      }
  
  return 0;
  }
  </code></pre>
  
  <p>But looks like it skips white space.  I switched to this...</p>
  
  <pre><code>char c;
  
  while ((c = getchar()) != EOF)  {
      text[textSize] = c;
      textSize++;
  }
  </code></pre>
  
  <p>which works perfectly but I know this from a C programming book.  Wondering how I would handle it in c++</p>