• Advertisement
Sign in to follow this  

gotoxy())

This topic is 4964 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

okay, here's the problem... i found on the net code for c++ that moves the console cursor on a wanted location, it should be the same as gotoxy(x,y) function in old pascal;) but it isn't .. murphys laws doh!;) i remember in pascal.. i wrote gotoxy(x,y) and after that outputed some text on screen, then i would again use gotoxy(x,y) to go on some other location on the screen, and outputed some more text over there.. now that code that i have found doesn't behave much like this .. example gotoxy(5,5); cout<< "blah"; gotoxy(1,25); cout << "Yeah!"; and after that the output is like i had wrote gotoxy(1,25); cout<< "blah"; cout << "Yeah!"; i hope that i have cleared what bugz me;) i am working on some kind of a console game;) something like pacman;) hehh;) i am using visual c++ 6.0 this is the gotoxy(int x,int y) function void gotoxy(int x, int y) { COORD coord; coord.X = x; coord.Y = y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord); } I am a old fashioned guy, and i don't know about windows programming, handles and stuff, this was easy to do in pascal, but here... huh;) .. thank you very much .. gado... ;)

Share this post


Link to post
Share on other sites
Advertisement
cout buffers. if you did a << flush right afterword it'd probably look liek you want.

otherwise, since you're using window specific console functions, I think there's TextOut or something in that api, too.

Share this post


Link to post
Share on other sites
okay, i found the answer, acctually Colin Jeanne from www.cpp-home.com 's forums helped me.. i needed to add "<< flush;" to my cout lines to make shure that they have printed..
thanks anyway;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement