title: C++ help with getline function with ifstream
body: <p>So I am writing a program that deals with reading in and writing out to a file. I use the getline() function because some of the lines in the text file may contain multiple elements. I've never had a problem with getline until now. Here's what I got.</p>
  
  <p>The text file looks like this:</p>
  
  <pre><code>  John Smith                       // Client name
    1234 Hollow Lane, Chicago, IL    // Address
    123-45-6789                      // SSN
    Walmart                          // Employer
    58000                            // Income
    2                                // Number of accounts the client has
    1111                             // Account Number
    2222                             // Account Number
  </code></pre>
  
  <p>And the code like this:</p>
  
  <pre><code>ifstream inFile("ClientInfo.txt");
  if(inFile.fail())
  {
      cout &lt;&lt; "Problem opening file.";
  }
  else
  {
      string name, address, ssn, employer;
      double income;
      int numOfAccount;
  
      getline(inFile, name);
      getline(inFile, address);
      // I'll stop here because I know this is where it fails.
  </code></pre>
  
  <p>When I debugged this code, I found that name == "John", instead of name == "John Smith", and Address == "Smith" and so on. Am I doing something wrong. Any help would be much appreciated.</p>