Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adjust cursor position 2

Status
Not open for further replies.

XoFF

Programmer
Jun 22, 2003
23
GB
in c++ you can by including library <conio.h> use gotoxy to adjust your cursor position.

Can anybody tell me how to use it in c?
 
Since conio is a C library, I'd imagine you use it in pretty much the same way.

Though you may need to use the cprintf() function in conio.h in place of the standard printf() routine. This is especially true if you want to start printing coloured text.
 
In *nix you will probably need to use the (n)curses
library. There are plenty of docs on line for this.
Do a google search.
 
Salem:

i use a very easy program to test <conio.h> and gotoxy function but the compiler can't recognize the library conio.h . I also thought conio.h was a c++ library
 
Which operating system and compiler do you have?
 
The mvprintw(3Curses) function allows you to position the cursor to x y coordinates and print a string in the window using the C printf(3C) syntax.

#include <curses.h>

main()
{
char user_name[64];

initscr();

mvprintw(12, 30, &quot;Center of the screen&quot;);
mvprintw(LINES - 1, (COLS / 2) - 6, &quot;Bottom Center&quot;);
mvprintw(0, 0, &quot;Enter your name:&quot;);
getstr(user_name);
...
...
endwin( );
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top