How to get input in a string in c++?
<p>I wrote following function </p>

<pre><code> void validateUser(void)
 {
         string uName;
         string uPassword;
         char c;

         map &lt;char*, char*&gt; authMap;
         authMap["balaji"] = "balaji";
         authMap["rohan"] = "rohan";

         cout &lt;&lt; "Please Enter your user name :";
         cin &gt;&gt; uName;
         cout &lt;&lt; "Please Enter your password :";
        // initTermios(0);
         while((c = getchar()) != '\n')
         {
           uPassword.push_back(c);
         }
         cout &lt;&lt; "YOU Entered :: "&lt;&lt;  uPassword &lt;&lt;std::endl;
}
</code></pre>

<p>When i executed the above function, i found that after entering user name i press enter key then control does not enter into while loop even if i did not entered any password string.
Ant solution to above ? Thanks in advace.</p>
