Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,940 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,421 people online right now. Registration is fast and FREE... Join Now!




Using Cin, and Getline with strings (Clear Buffer)

 
Reply to this topicStart new topic

Using Cin, and Getline with strings (Clear Buffer)

lockdown
5 Jan, 2008 - 12:48 PM
Post #1

D.I.C Regular
Group Icon

Joined: 29 Sep, 2007
Posts: 376



Thanked: 1 times
Expert In: PC, Support

My Contributions
When using a cin >> and then later using the getline(cin,variable) what do you uses to clear the buffer first? Forgot the command that you uses to do this.
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Using Cin, And Getline With Strings (Clear Buffer)
5 Jan, 2008 - 12:52 PM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,353



Thanked: 51 times
Dream Kudos: 25
My Contributions
Look at the .ignore() method of the cin object.
User is online!Profile CardPM
+Quote Post

lockdown
RE: Using Cin, And Getline With Strings (Clear Buffer)
5 Jan, 2008 - 12:54 PM
Post #3

D.I.C Regular
Group Icon

Joined: 29 Sep, 2007
Posts: 376



Thanked: 1 times
Expert In: PC, Support

My Contributions
QUOTE(Amadeus @ 5 Jan, 2008 - 01:52 PM) *

Look at the .ignore() method of the cin object.


Thanks yeah I uses it awhile back and forgot what it was. I had a issue finding it on the reference sites.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/8/09 04:39PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month