5
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by frogboy77
0

Because in this function the characters are extracted until either n-1 characters have been extracted or the delimiting character '\n' is found.
Here's a useful link on this topic: click me

Edited by Basteon: n/a

0

Be careful. If cin.get() --but not cin.getline()-- reads an empty line it will set something called the failbit. The failbit prevents further input to cin.get(). Use cin.clear() to unset the failbit!

If you call cin.get() or cin.getline() and the input string is longer than the number of characters specified, these characters are put in a queue and will be submitted next time cin.get() or cin.getline() is called, but cin.getline() will also set the failbit. Be careful when you use these commands!

2

>>answer immediately please

Demanding immediate response is considered a very rude comment, which is probably the reason you got a negative rep for your post.

Votes + Comments
It is indeed.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.