getline

Hello,

When I use getline(cin,var) sometimes it is skipped.
Why is it skipped??
I know there is cin.ignore();, but it doesn't mean I must use it whenever I want to use getline() right??

Thanks..
Last edited on
If the stream is valid it is not skipped.

It may be called at a point when there is nothing of substance left in the buffer, so nothing of substance ends up in var.

The most common problems are a stream extraction (>>) followed by a getline.

I almost never use .ignore().


You need to show the code that you are having problems with.
Topic archived. No new replies allowed.