setting Cursor Position in C???

This is a discussion on setting Cursor Position in C??? within the C Programming forums, part of the General Programming Boards category; Is it the same in C++ where you need x and y coordinates. Can someone give me some examples of ...

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    34

    setting Cursor Position in C???

    Is it the same in C++ where you need x and y coordinates. Can someone give me some examples of CursorPositions in C or point to me to a website... thanks

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    It depends on your operating system. If you are using Windows, check out my consoles tutorials. Part 2 covers cursor movement, amongst other things. They are now in C++ but the functions are the same, just use printf() instead of cout!
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    Jul 2003
    Posts
    26

    Wink cursor position

    The answer to your question is yes. The x y coords are the same. If you have Borland simply include the <conio.h> library and use the gotoxy(x, y); function. In windows this is how I do it...

    void SetPosition(int X, int Y)
    {
    HANDLE Screen;
    Screen = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD Position={X, Y};

    SetConsoleCursorPosition(Screen, Position);
    }

    Sure hope this helped..thanks
    "Borland Rocks!"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. VS .net project setting question
    By Jumper in forum C++ Programming
    Replies: 1
    Last Post: 05-13-2004, 11:03 AM
  4. Your favourite fantasy game setting?
    By fry in forum Game Programming
    Replies: 4
    Last Post: 10-16-2002, 06:26 AM
  5. Setting the background color of my main window
    By Garfield in forum Windows Programming
    Replies: 5
    Last Post: 07-06-2002, 11:25 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21