Click to See Complete Forum and Search --> : Alternative to gotoxy()


sunveer
August 8th, 2009, 05:40 AM
Since gotoxy() function can have maximum values (35,25)
I want to know is there any alternative to this which i can use in Turbo C++ 4.5 version.
I have to make a project and therefore i urgently require a one for a better look of my project.

Paul McKenzie
August 8th, 2009, 10:27 AM
Since gotoxy() function can have maximum values (35,25)There is no such function as "gotoxy()" in the Windows API.
I want to know is there any alternative to this which i can use in Turbo C++ 4.5 version.Why such an old compiler? Using compilers that are close to 20 years old is not the way to start (or finish) projects, unless you are working strictly with the 16-bit MSDOS operating system.

If your "gotoxy()" is a function that moves the screen cursor, the correct way to do this for the Windows OS is to use the Windows Console API.

http://msdn.microsoft.com/en-us/library/ms682073(VS.85).aspx

And the function to use is SetConsoleCursorPosition.

Regards,

Paul McKenzie

sunveer
August 10th, 2009, 09:04 AM
can gotoxy() have negative parameters like gotoxy(33,-22)
I have used it and it is working.
I typed somewhat 30 lines and i used gotoxy(1,1) and it was moving cursor to 6th line instead of starting position of output screen and it was placed at starting only when i used gotoxy(1,-5)
Is it correct to use.

hoxsiew
August 10th, 2009, 11:32 AM
gotoxy() is a Borland specific function that uses DOS interrupts to move the cursor position around in a DOS window (not an NT console). Either get a new compiler, or go back to Windows 98.

Paul McKenzie
August 10th, 2009, 09:46 PM
can gotoxy() have negative parameters like gotoxy(33,-22)You keep asking questions on "gotoxy", and I'm telling you that there is no such function for the Windows API.

This is the Windows API forum, and I already posted to you the links that show you how to move the screen cursor using Windows API calls.
I have used it and it is working.It does not work for an NT console program. Calling that function will probably just crash. As hoxsiew stated, that function only works for MSDOS 16-bit operating system and MSDOS 16-bit consoles.

Regards,

Paul McKenzie

sunveer
August 11th, 2009, 07:30 AM
what can i do? i have to use only that compiler as our school provides us that and we do all our programs on that compiler.
And the today used commands that you have mentioned doesn't work on that.
That is why i was asking for the commands that work on turbo only.
But thank you for the advice.
I will definitely go to new compiler at my home.

Paul McKenzie
August 12th, 2009, 06:36 PM
what can i do? i have to use only that compiler as our school provides us that and we do all our programs on that compiler.You cannot learn C++ properly using Turbo C++ 4.5. The compiler is non-standard and is almost 20 years old. If you paid money for the course you're taking, you should drop the class and ask for a refund -- you're wasting your time (and money).
And the today used commands that you have mentioned doesn't work on that. That is why i was asking for the commands that work on turbo only.You are in the Windows API forum, where the Windows API is discussed. You are not in the "turbo C++" forum. Therefore the answer I gave you as to how to move the cursor is the correct one when programming a console Windows application.

If you want "turbo C++" answers, then post in the Non-Visual C++ forum. But let me say that you will more than likely get the same answers you got here.

Regards,

Paul McKenzie