Can someone please explain this.
Thanks in advance!
Can someone please explain this.
Thanks in advance!
get() retrieves a single character
getline() retrieves multiple characters (as many as it takes to get to the number you specify or until the delimiter ['\n' by default] is read). note that the delimiting character is not inserted into the buffer.
Last edited by LuckY; 04-28-2003 at 05:00 PM.
Then is
equivalent toCode:fin >> cChar;
Thanks in advance.Code:fin.get(cChar)
No.
The difference between operator>>() and get() is that operator>>() ignores whitespace.
So if the source data was "a b c" and you did fin >> ch 3 times, you would have extracted 'a' 'b' and 'c'
However if you did fin.get() three times, you would have extracted 'a' ' ' and 'b'
Wow, that helps alot. Thanks!!!