Who am I?
I'm Luis. I'm a Technical Consultant and Photographer.
If you want to contact me you can send me an e-mail to lmurillo [at] codebeta [dot] net
If you're in Costa Rica you can call me at 8343-5641
Photos (view gallery)
Most Viewed
- Photos from the roof - 2,619 views
- Google Chrome… - 1,793 views
- OpenFiler 2.3 - Round 1 - 686 views
- Some final thoughts on OpenFiler 2.3 - 334 views
- OpenFiler 2.3 - Round 2 - 245 views
- My first Bash script - 228 views
- Reverse SSH Tunnel - 196 views
- Arepas Costarricenses - 194 views
- Setting up an OpenVPN Server - 150 views
- Perfect Paper Passwords and SSH on Linux - 142 views
Recent Posts
- Updating the watermarking script November 20, 2008
- On Fire Party November 19, 2008
- Coming back November 16, 2008
- No weekend trip and almost lost all my blog October 28, 2008
- More Windows fail… October 22, 2008
Recent Comments
Categories
Codebeta Users
Personal
photography
Webcomic
Google Reader Shared
- 15 MORE Images You Won't Believe Aren't Photoshoppeddigg / lmurillo / history lmurillo
- How to say no to coworkersdigg / lmurillo / history lmurillo
- Share a Screen SessionDaily Vim Travis Whitton
- Spider Missing After Trip To Space StationSlashdot CmdrTaco
- 10 Astounding Astrophotos by Phil HartDigital Photography School Darren
- Peter Otto's Tourist PlacesThe Exposure Project noreply@blogger.com (The Exposure Project)
- Creating a Certificate Authority with OpenSSLPlanet NYLUG Kees
- Towards a World Wide Grid?Slashdot samzenpus
- Researchers Getting the Lead Out of ElectronicsSlashdot samzenpus
- Windows Breaks Into Supercomputer Top 10Slashdot timothy












Problems with std::cin
Well I was working on a code and I have a menu configured so the user can choose from the different options that there are. But apparently the program overlooks the std::getline() that go after that part :S
Well I was working on a code and I have a menu configured so the
user can choose from the different options that there are. But
apparently the program overlooks the std::getline() that go after that
part :S
Here is what I’m doing:
int main(int argc, char **argv)
{
unsigned int muiOption = 0;
std::string mszString;
…
do{
…
std::cout < < “Main Menu” << std::endl;
/*The options are included here*/
std::cout << “Option: “;
std::cin >> muiOption;
switch(muiOption){
case 1:
std::cout < < “Write a string of text: “;
std::getline(std::cin, mszString);
std::cout << “You typed: ” << mszString << std::endl;
break;
case 2:
…
}
}while(mszOption != 3);
return 0;
}
Now, when the user selects an option other than 3, the code simply
skips the std::getline() and it prints the std::cout that are there. So
the output looks like this:
so what could I be doing wrong? Can anyone tell me?
The code can be downloaded from http://lexington.opencurve.org/~lmurillo/p3.cpp
There are two required files, in case you want to compile the code:
http://lexington.opencurve.org/~lmurillo/lista.cpp
http://lexington.opencurve.org/~lmurillo/lista.h
[NOTE: Parts of the code are in spanish and other parts are in english]
-LMurillo