Archived

This topic is now archived and is closed to further replies.

sanguineraven

Gotoxy or other cursor position in c++

Recommended Posts

I started programming in Pascal, and two functions I found very useful were: clrscr - clears the screen and sets cursor at 0,0 gotoxy - positioned the cursor at set coords in the console Now although I''m only using console programming in c++ as a start, I would still be interested if this is possible? I have searched and found threads on clearing the screen. As was said there, most of the methods are "ugly" but since I am only using it for beginner purposes I have nothing against this. I also saw that I could use a gotoxy command by including conio.h and gotoxy(x,y); When I compile i get the error [Linker error] undefined reference to `gotoxy'' using the syntax gotoxy(4,5); What did I do wrong? And should I just not bother at all with this? What about me? What about Raven?

Share this post


Link to post
Share on other sites
I think gotoxy() is also available with Borland? Something like that. So if you are using, say, Visual C++ it won''t work. Same with the clrscr() function.

Share this post


Link to post
Share on other sites
Uh, for windows they removed all backwards compatability and therefore gotoxy is not included (as it was an old interrupt routine which windows disallows you using anymore).

That does not mean that it cannot be done. I have created a little library for anybody who so wishes to use gotoxy for the windows console. It also includes some freaky stuff for changing colours in the console and various other such techniques

Go over to my web site and then click on "Utilities" and then "cConsole". There are two files their for wrapping windows nasty console classes. Basically (upon noticing this line in the header: "extern class cConsole Console;") we just go "Console." and then whichever function you want.

Hope thats good for you .. Agreed its a little bit nasty on the code side, but that was because I was utilising it to create a scrollable menu system (which I ported from Pascal)

Good Luck.

-Chris Bennett of Dwarfsoft - The future of RPGs GPA Thanks to all the goblins in the GDCorner niche

Share this post


Link to post
Share on other sites