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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gotoxy () in iostream.h?

Status
Not open for further replies.

paulbradley

Programmer
Oct 9, 2002
158
0
0
GB
is there a gotoxy() function (or equivelent) in the iostream.h ?
Thanks.
 
No. gotoxy has never been in iostream, only in conio. There are non-straightforward, compiler-specific equivalents available.

And never use <iostream.h>. Use <iostream>. The form with the .h is a legacy library intended only for backwards compatibility with pre-standard programs and should never, ever be used in new programs.
 
Hi,
this is equivalent to the gotoxy() funtion.Its easy to understand.Have fun!

#include <windows.h>
#include <iostream.h>

void gotoxy(int,int);

int main()
{
gotoxy (5,10);
cout << &quot;This text is at x5, y10&quot; << endl;
return 0;
}

void gotoxy(int X, int Y)
{
COORD coord;
coord.X = X;
coord.Y = Y;

HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hConsole, coord);
}

 
Hi, Psidro, is good you to post a new FAQ with consoles, because it became a really frequently asked question. Ion Filipski
1c.bmp


filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top