When using cin>> enter is needed to go on, is there a way so it just does it when the key is pressed?
Thank you in advance
Rasped
When using cin>> enter is needed to go on, is there a way so it just does it when the key is pressed?
Thank you in advance
Rasped
Don't use cin...
use
getchar(character);
use
getche(character)
use
getch(character)
for strings use
getline(cin,string, terminator)
where the terminator could be a '\n' newline (enter) or even a character like '#'
or
cin.getline(char_array, number to get, terminator)
where the number to get is an integer value one less than your array size like 50 and terminator is like above.
I guess it all depends on what you want to do. There are others as well....
Blue
try this:
---------------------------------------
string UsrInpt(int length){ // "length" = length of input
string message = ""; //the input
int x=0; // length count
do{
message+=getche(); // cancatente
x++;
}while(x!=length); // "message" has the same amount of character as "length"
return (message);
}
---------------------------------------
This should let you enter an amount of inputs w/o enter.
Yoshi
you could also read directly from the keyboard, but i forget how to do this, so i cant show you
that way there's no waiting... however if you want the scan code as well i recommend writing code which calls an interrupt to get it... also, understanding the ways of the keyboard bufferred input scheme is quite helpful...Code:if (kbhit ()) return (getch ()); else return (0);
hasafraggin shizigishin oppashigger...