title: Trying to Read a Line of Keyboard Input in C++
body: <p>I mam trying to complete a college assignment in C++ and am having trouble with what should be a very basic operation. I am trying to read a string of characters from the keyboard. This is the relevant code:</p>
  
  <pre><code>  string t;
    cout &lt;&lt; endl &lt;&lt; "Enter title to search for: ";
    getline(cin, t, '\n');  
  </code></pre>
  
  <p>I understand, that the last line is supposed to read the input buffer (cin , in this instance) and store the character in the 't' string until it reaches a new line character and then continue the program flow.</p>
  
  <p>However, when I run my code in XCode, it just sort of jumps over the <code>getline</code> function and treats 't' as an empty string.</p>
  
  <p>What's going on?  I tried using <code>cin &gt;&gt; t</code> but that just read characters forever - Why cant I get this to behave?</p>