Thread: gotoxy() and arrow keys

  1. #1
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373

    gotoxy() and arrow keys

    What do i need to include for gotoxy()? I tried conio.h, and it's not there. And what are the commands for using arrow keys?

    Thank you!
    This war, like the next war, is a war to end war.

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    You might try this
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    I remade it myself. Its very similar to what you suggested.

    Code:
    void dc(char szChar, int X, int Y)
    {	
    	HANDLE OutputH;
    	COORD position = {X, Y};
    
    	OutputH = GetStdHandle(STD_OUTPUT_HANDLE);
    
    	SetConsoleCursorPosition(OutputH, position);
    
    	cout << szChar;
    
    }
    This war, like the next war, is a war to end war.

  4. #4
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    this is the same as above except more efficient...

    Code:
    void gotoxy(short x, short y)
     {
       COORD coord = (x, y);                                                     SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);  
    }
    use getch() or getche() depending on your compiler for input with the arrow keys and look at asciitable.com for ascii values

  5. #5
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    would the arrow keys be DC1, DC2, DC3, and DC4. Dc is device controls.
    This war, like the next war, is a war to end war.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gotoxy question
    By Draco in forum C Programming
    Replies: 5
    Last Post: 04-25-2002, 01:28 PM