-
overflowing a char
Simple one I think...
I am reading data in from the keyboard and at one point I want the user to input a single char, now if the user provides "AAA" instead of just 'A' the second and third A gets pushed into the next variable when I try and read it in Any idea how to just drop off the extra junk after the first letter?
I have tried cin.ignore() but that will only chop off one character...
-
did you try the getchar() function? It only allows one character to be inputted.
:)
-
Hey crptc, can you explain something to me? What's the difference between getch() and getchar()?
-
One is defined in conio.h, the other is defined in stdio.h. There are probably other differences, but nothing major.
Z.
-
If in doubt, use the one from stdio.h :)