cin.get not working in vista

If you put a cin.get (buffer,25) inside a while loop it will not work. (just keeps looping without allowing the input)

Running vista with a dual core, AMD processor, Visual C++ 2008

Any ideas??
closed account (z05DSL3A)
Without seeing specific code, I'll have to make the assumption that you are not clearing the stream after the call to get.

istream& get (char* s, streamsize n );
Extracts characters from the stream and stores them as a c-string into the array beginning at s. Characters are extracted until either (n - 1) characters have been extracted or the delimiting character '\n' is found. The extraction also stops if the end of file is reached in the input sequence or if an error occurs during the input operation.
If the delimiting character is found, it is not extracted from the input sequence and remains as the next character to be extracted. Use getline if you want this character to be extracted (and discarded).
The ending null character that signals the end of a c-string is automatically appended at the end of the content stored in s.
from: http://www.cplusplus.com/reference/iostream/istream/get.html
Last edited on
Topic archived. No new replies allowed.