| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Cin.get
Code:
void Encode::getInput()
{
cin.get( message, 255 ); //input the message
}
Hey how do I use cin.get? Is this right? When I single step through it, the program just passes over it and never gives me the opportunity to input anything. |
|
#2
|
|||
|
|||
|
Ok i solved my problem by using this code:
Code:
char dummy(0); // extract newline from previous read
std::cin.get(dummy);
assert( '\n'==dummy );
Can someone explain to me why this fixed it? |
|
#3
|
|||
|
|||
|
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Cin.get |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|