Pointers to structures - having trouble understanding specific fragments of code
<p>Here is the code:</p>

<pre><code>// pointers to structures
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;sstream&gt;
using namespace std;

struct movies_t {
  string title;
  int year;
};

int main ()
{
  string mystr;

  movies_t amovie;
  movies_t * pmovie;
  pmovie = &amp;amovie;

  cout &lt;&lt; "Enter title: ";
  getline (cin, pmovie-&gt;title);
  cout &lt;&lt; "Enter year: ";
  getline (cin, mystr);
  (stringstream) mystr &gt;&gt; pmovie-&gt;year;

  cout &lt;&lt; "\nYou have entered:\n";
  cout &lt;&lt; pmovie-&gt;title;
  cout &lt;&lt; " (" &lt;&lt; pmovie-&gt;year &lt;&lt; ")\n";

  return 0;
}
</code></pre>

<p>Taken from <a href="http://www.cplusplus.com/doc/tutorial/structures/" rel="nofollow">http://www.cplusplus.com/doc/tutorial/structures/</a>.  I was hoping I could get clarification on a few things.</p>

<ol>
<li><p>What is <code>getline</code> and how does it work?  I tried looking up the documentation, but I'm still having trouble understanding.  Also, what exactly is <code>cin</code> and how is it being used with <code>getline</code>?</p></li>
<li><p>If I understand correctly, <code>pmovie-&gt;title</code> essentially says that <code>pmovie</code> points to the member <code>title</code> of the object <code>amovie</code>?  If so, and it's not already clear from the explanation to #1, how does <code>getline (cin, pmovie-&gt;title)</code> work?</p></li>
<li><p>Now this <code>(stringstream) mystr &gt;&gt; pmovie-&gt;year</code> is giving me the most trouble.  What is a <code>stringstream</code>, and are we using it like we would cast a double as a int, for example?</p></li>
</ol>

<p>Thank you all!</p>
