printing to a dos window, with specified co-ordinates?

This is a discussion on printing to a dos window, with specified co-ordinates? within the C++ Programming forums, part of the General Programming Boards category; how would i go about printing a single character to a specified co-ordinate??...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    7

    printing to a dos window, with specified co-ordinates?

    how would i go about printing a single character to a specified co-ordinate??

  2. #2
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    Some compilers have a gotoxy() function in conio.h, if yours doesn't...
    Code:
    void gotoxy(int x, int y)
    {
         HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
         COORD pos = {x, y};
         SetConsoleCursorPosition(hOut, pos);
    }
    0, 0 is the top-left corner of the window
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    7
    thanks for the quick reply man!

  4. #4
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    np
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Window scrollbar
    By maxorator in forum Windows Programming
    Replies: 2
    Last Post: 10-07-2005, 12:31 PM
  2. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  3. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  4. opengl help
    By heat511 in forum Game Programming
    Replies: 4
    Last Post: 04-05-2004, 01:08 AM
  5. DOS window
    By speve in forum C Programming
    Replies: 1
    Last Post: 12-17-2001, 04:42 AM

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