Click to See Complete Forum and Search --> : getline(cin, str_Var, '\n') doesn't work


IL96
07-17-2001, 08:48 PM
HI, guys, once again I have a problem for which i'm seeking a solution.
I'm writing a program, a part of which prompts a user to enter "title" and "Author" as strings.
I'm using getline(cin, str_Var, '\n') like this:
cout<<"Enter Title: ";
getline(cin, str_Var, '\n');
str_Title=str_Var;
cout<<"Enter Author: ";
getline(cin, str_Var, '\n');
str_Author=str_Var;

When the program runs I have to press "ENTER" twice to pass the first getline operator, and it doesn't save the str_var to str_title, but put's it into str_author after secong getline...

I tried using cin.ignore();
but that doesn't help.
I also installed SP5 for vis studio 6...

HELP PLEASE this thing is killing me !

------------------
There are no stupid questions, there are stupid answers.

dighn
07-18-2001, 01:06 AM
that's a known bug... vc++ isn't the best compiler *sigh*

this tells u how to fix it http://www.msoe.edu/~taylor/resources/msvc60.htm

------------------
So easy to use, no wonder it's number one!!!
Where do you want to go today?
Member of NT Jocks (http://yoconsoft.hypermart.net/images/ntjockdighn.gif)
Tesla coils are not weapons

IL96
07-18-2001, 10:38 AM
Hey, thanks man. Too bad i can't change this file here in college, but I'll try it at home.

------------------
There are no stupid questions, there are stupid answers.