Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


InputScreenBuffer getting up arrow input from nowhere, how?

This topic is 5412 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

for some reason my screen buffer keeps recieving input that someone hit the up key. Um. Its not helping my program. Anyone know the reason? It doesn't get it every time, but because of the loop I use it happens a bunch a times, and it always happens the first time around. Also, can anyone explain what FlushConsoleInputBuffer does? [edited by - RyoxSinfar on January 22, 2004 7:48:46 PM] [edited by - RyoxSinfar on January 23, 2004 9:45:19 AM]

Share this post

Link to post
Share on other sites
This isn''t helping much, post some code and wait. It''s not that we are pressing F5 all the time to check for new posts.

Show your code, and what it''s suppose to do and it''ll be fine.


-Earth is 98% full. Please delete anybody you can.

Share this post

Link to post
Share on other sites
well here it is...

int NPlay() { // begin NPlay function
int check = 0;
int Stop = 0; // will be used for the exit loop for the while statement
cout<<"Please enter the number of players, if the number is single digit please enter in a 0 first, and must be higher than one";

while(Stop == 0) { // starts loop to get input
ReadConsoleInput(iHandle, &input, 2, &info); // looks for input using input handle, saves all input info to input variable, 1 represents the number of input we get and info keeps the DWORD variable happy

if(input.Event.KeyEvent.bKeyDown) { // checks to see if a key was pressed down
Players = INTReturn((char)input.Event.KeyEvent.uChar.AsciiChar); // looks for what character was entered

while(Players < 0) { //checks to make sure the number entered was allowable
Players = INTReturn(Again()); // loops until aloud number is entered

pos.Y++; // lowers Y by one for next line
SetConsoleCursorPosition(oHandle, pos); //resets cursor positon
cout<<"Please enter the second digit... "<
while(Stop == 0) {
ReadConsoleInput(iHandle, &input, 1, &info); // looks for input and will take if true

if(input.Event.KeyEvent.bKeyDown) { // checks for a pressed key
check = INTReturn((char)input.Event.KeyEvent.uChar.AsciiChar);

while(check < 0) {
check = INTReturn(Again());

Players = (10 * Players) + check; //makes first number entered the first digit and then adds second number
Stop = 1; // ends all loops

return Players; // returns how many players

then this also includes

char Again() {
char Fix = '' '';
cout<<"Please re enter the last number but please check what is aloud then re enter the number.";

while(Fix == '' '') {
ReadConsoleInput(iHandle, &input, 1, &info);

if(input.Event.KeyEvent.bKeyDown) {
Fix = (char)input.Event.KeyEvent.uChar.AsciiChar;
return Fix;

and just know that INTReturn is a function I made to change the characters I get into integers

Share this post

Link to post
Share on other sites
well I fixed it. I just had to change the if statement that checked for key input so that it also made sure the Ascii code said it was a number. But then I had a problem with it getting the number I pressed twice. but I fixed THAT with a sleep for 100 then clearing the buffer. If anyone else gets this problem. Thats the fix I used.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!