console cursor postition

Hi, I'm trying to move the cursor (not mouse cursor) within the console window. As I understand I can use a function in conio.h called gotoxy(). I cant get this to work. Does anyone know how I can move the cursor so I can print text anyware in the console window I want.

I would really like to print a menu of options and above that, I would like the user to enter their selection.

And I DONT want to use MFC or anything that calls windows.h

Right now, I'm using Dev-C++ 4 as a compiler.

~Eric

Comments

  • : Hi, I'm trying to move the cursor (not mouse cursor) within the console window. As I understand I can use a function in conio.h called gotoxy(). I cant get this to work. Does anyone know how I can move the cursor so I can print text anyware in the console window I want.
    :
    : I would really like to print a menu of options and above that, I would like the user to enter their selection.
    :
    : And I DONT want to use MFC or anything that calls windows.h
    :
    : Right now, I'm using Dev-C++ 4 as a compiler.
    :
    : ~Eric
    :

    Well guess what, there is no way to do things like that in standard C/C++.

    You're working on Windows so there's nothing wrong with using windows.h and other windows specific header files to do your console manipulations.

    If you're trying to write a cross-platform program then you'll need to either use OS specific code for each platform's build or you'll need to use a cross-platform library that does what you need.





    [italic][blue]To understand recursive, first you need to understand recursive[/blue][/italic]

  • : : Hi, I'm trying to move the cursor (not mouse cursor) within the console window. As I understand I can use a function in conio.h called gotoxy(). I cant get this to work. Does anyone know how I can move the cursor so I can print text anyware in the console window I want.
    : :
    : : I would really like to print a menu of options and above that, I would like the user to enter their selection.
    : :
    : : And I DONT want to use MFC or anything that calls windows.h
    : :
    : : Right now, I'm using Dev-C++ 4 as a compiler.
    : :
    : : ~Eric
    : :
    :
    : Well guess what, there is no way to do things like that in standard C/C++.
    :
    : You're working on Windows so there's nothing wrong with using windows.h and other windows specific header files to do your console manipulations.
    :
    : If you're trying to write a cross-platform program then you'll need to either use OS specific code for each platform's build or you'll need to use a cross-platform library that does what you need.
    :
    :
    :
    :
    :
    : [italic][blue]To understand recursive, first you need to understand recursive[/blue][/italic]

    or you could work around wiht fancy macros

    #define a macro like changeCursor(x,y)
    and make it a wrapper(is that correct terminology?)

    [code]
    #define changeCursor(x,y)
    winchangecur(x,y)
    [/code]

    winchangecur is the real function(or macro, i dont think you need a function for that)

    then use only changeCursor in ur code, but as u port the program, write a new function and place it there in changeCursor's definition instead of winchangcur

    by the way, i would like to know how you do that using only the API, not MFC, non C++

    thanx you two
    {2}rIng
  • : : : Hi, I'm trying to move the cursor (not mouse cursor) within the console window. As I understand I can use a function in conio.h called gotoxy(). I cant get this to work. Does anyone know how I can move the cursor so I can print text anyware in the console window I want.
    : : :
    : : : I would really like to print a menu of options and above that, I would like the user to enter their selection.
    : : :
    : : : And I DONT want to use MFC or anything that calls windows.h
    : : :
    : : : Right now, I'm using Dev-C++ 4 as a compiler.
    : : :
    : : : ~Eric
    : : :
    : :
    : : Well guess what, there is no way to do things like that in standard C/C++.
    : :
    : : You're working on Windows so there's nothing wrong with using windows.h and other windows specific header files to do your console manipulations.
    : :
    : : If you're trying to write a cross-platform program then you'll need to either use OS specific code for each platform's build or you'll need to use a cross-platform library that does what you need.
    : :
    : :
    : :
    : :
    : :
    : : [italic][blue]To understand recursive, first you need to understand recursive[/blue][/italic]
    :
    : or you could work around wiht fancy macros
    :
    : #define a macro like changeCursor(x,y)
    : and make it a wrapper(is that correct terminology?)
    :
    : [code]
    : #define changeCursor(x,y)
    : winchangecur(x,y)
    : [/code]
    :
    : winchangecur is the real function(or macro, i dont think you need a function for that)
    :
    : then use only changeCursor in ur code, but as u port the program, write a new function and place it there in changeCursor's definition instead of winchangcur
    :
    : by the way, i would like to know how you do that using only the API, not MFC, non C++
    :
    : thanx you two
    : {2}rIng
    :


    Using macros to wrap OS specific code is the same as what I already mentioned when I said "use OS specific code for each platform's build"


    For Windows, look for SetConsoleCursorPosition()
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/console_functions.asp

    [italic][blue]To understand recursive, first you need to understand recursive[/blue][/italic]

  • : : : : Hi, I'm trying to move the cursor (not mouse cursor) within the console window. As I understand I can use a function in conio.h called gotoxy(). I cant get this to work. Does anyone know how I can move the cursor so I can print text anyware in the console window I want.
    : : : :
    : : : : I would really like to print a menu of options and above that, I would like the user to enter their selection.
    : : : :
    : : : : And I DONT want to use MFC or anything that calls windows.h
    : : : :
    : : : : Right now, I'm using Dev-C++ 4 as a compiler.
    : : : :
    : : : : ~Eric
    : : : :
    : : :
    : : : Well guess what, there is no way to do things like that in standard C/C++.
    : : :
    : : : You're working on Windows so there's nothing wrong with using windows.h and other windows specific header files to do your console manipulations.
    : : :
    : : : If you're trying to write a cross-platform program then you'll need to either use OS specific code for each platform's build or you'll need to use a cross-platform library that does what you need.
    : : :
    : : :
    : : :
    : : :
    : : :
    : : : [italic][blue]To understand recursive, first you need to understand recursive[/blue][/italic]
    : :
    : : or you could work around wiht fancy macros
    : :
    : : #define a macro like changeCursor(x,y)
    : : and make it a wrapper(is that correct terminology?)
    : :
    : : [code]
    : : #define changeCursor(x,y)
    : : winchangecur(x,y)
    : : [/code]
    : :
    : : winchangecur is the real function(or macro, i dont think you need a function for that)
    : :
    : : then use only changeCursor in ur code, but as u port the program, write a new function and place it there in changeCursor's definition instead of winchangcur
    : :
    : : by the way, i would like to know how you do that using only the API, not MFC, non C++
    : :
    : : thanx you two
    : : {2}rIng
    : :
    :
    :
    : Using macros to wrap OS specific code is the same as what I already mentioned when I said "use OS specific code for each platform's build"
    :
    :
    : For Windows, look for SetConsoleCursorPosition()
    : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/console_functions.asp
    :
    : [italic][blue]To understand recursive, first you need to understand recursive[/blue][/italic]
    :
    :
    Here is a good site with tutes on console windows:

    http://www.adrianxw.dk/SoftwareSite/index.html
  • wow, this site is really cool: http://www.adrianxw.dk/SoftwareSite/index.html thanks for all the information. i didnt realize there was a windows.h file that comes with dev-c++. i really like that site b/c it allows you to draw things on a console window.

    thanks everyone!
    Eric
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories