help with cin.getline()
Hi there good people.
Ok i'm puzzled, i got his as my main(), but I defined other functions b4 (just for the record, since believe that they have no influence whatsoever in what's happening)
cout<<"O APONTADOR DE HISTORIAS"<<endl;
if (escolha == 1)
cin.getline(txt, 1000, '\n');
//does some other stuff.....
my problem is the program doesn't stop at cin.getline(....) as spouzed, and read the input. This looks pretty straight forward to me, that's why it puzzles me even more. All the #includes are present.
So if somebody could please clear me out on this matter, i would be ever so much appreciated.
thankxx in advance for your kind attention.
PS - in case you're wondering what language is in between quotes it's Portuguese
The statement -
is leaving a '\n' in the buffer which is then being picked up by getline causing it to terminate immeadiately. If you put
after cin>>escolha; then it will remove any stray input and the newline.