CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2009
    Posts
    8

    Alternative to gotoxy()

    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.

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Alternative to gotoxy()

    Quote Originally Posted by sunveer View Post
    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/libr...73(VS.85).aspx

    And the function to use is SetConsoleCursorPosition.

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Jun 2009
    Posts
    8

    Re: Alternative to gotoxy()

    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.

  4. #4
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Alternative to gotoxy()

    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.

  5. #5
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Alternative to gotoxy()

    Quote Originally Posted by sunveer View Post
    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

  6. #6
    Join Date
    Jun 2009
    Posts
    8

    Re: Alternative to gotoxy()

    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.

  7. #7
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Alternative to gotoxy()

    Quote Originally Posted by sunveer View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured