Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

writing at a given location on the screen

Status
Not open for further replies.

kenguru

Programmer
May 14, 2004
173
RO
Hi everyone,

Does anyone know how could i write to a given location(coordinates) on the screen from a cpp source code? For example I would like to write the text at x=50, y=100.
Please write if you some suggestions:)
Thank's
Kenguru
 
I figure you mean inside a console
Code:
#include <windows.h> 

void gotoxy(int x, int y)
{
  COORD coord;
  coord.X = x;
  coord.Y = y;
  SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}

But then you'll need to stick to other Console Functions for the actual output as well.

I very much doubt that standard C++ 'cout' will honor whatever you do to the cursor using this method.

--
 
Hmmm....i understand. Thank's for your reply.
Could you tell me please if there is a simpler way for drawind a line between two points(x,y)? Is there a function for this?
Thank's
Kenguru
 
The console is not a graphical device. You can manage crude diagrams consisting of only vertical and horizontal lines, but that's about it.

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top