Thread: gotoxy()

  1. #1
    Registered User Commander's Avatar
    Join Date
    Sep 2001
    Posts
    801

    gotoxy()

    is there a way to get the current courser position.., so if I put that in the position numbers in the gotoxy() function, it'll stay in the same spot?
    thnkx
    oh i'm sorry! i didn;t realize my fist was rushing to meet ur face!

    MSN :: [email protected] []*[]

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    In my compiler (Borland 5.5) I have wherex() and wherey(). Maybe you have these?

    I only found them by opening conio.h and looking to see what function prototypes are in there.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    It's not terribly difficult to create a Windows implementation of wherex and wherey with gotoxy from the FAQ.
    Code:
    #include <windows.h>
    
    COORD coord;
    
    void gotoxy(int x, int y)
    {
      coord.X = (short)x;
      coord.Y = (short)y;
      SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
    }
    
    int wherex ( void )
    {
      return coord.X;
    }
    
    int wherey ( void )
    {
      return coord.Y;
    }
    -Prelude
    My best code is written with the delete key.

  4. #4
    Registered User Commander's Avatar
    Join Date
    Sep 2001
    Posts
    801
    thankx guys
    oh i'm sorry! i didn;t realize my fist was rushing to meet ur face!

    MSN :: [email protected] []*[]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What is gotoxy??
    By Beachblue in forum C Programming
    Replies: 6
    Last Post: 11-23-2008, 01:24 AM
  2. Tic Tac Toe movement
    By $l4xklynx in forum Game Programming
    Replies: 4
    Last Post: 11-06-2008, 07:22 PM
  3. gotoxy(); help!!
    By clique in forum C Programming
    Replies: 2
    Last Post: 10-07-2008, 04:08 AM
  4. Want to see if I am using gotoxy the right way ...
    By o0obruceleeo0o in forum C++ Programming
    Replies: 5
    Last Post: 04-22-2003, 04:17 PM
  5. Is gotoxy ansi?
    By MeneLaus in forum C Programming
    Replies: 2
    Last Post: 05-18-2002, 02:48 PM