box-o-sand/basics/scanw_example.c

21 lines
682 B
C
Raw Normal View History

2009-11-19 00:38:43 +00:00
#include <ncurses.h> /* ncurses.h includes stdio.h */
#include <string.h>
int main()
{
char mesg[]="Enter a string: "; /* message to be appeared on the screen */
char str[80];
int row,col; /* to store the number of rows and *
* the number of colums of the screen */
initscr(); /* start the curses mode */
getmaxyx(stdscr,row,col); /* get the number of rows and columns */
mvprintw(row/2,(col-strlen(mesg))/2,"%s",mesg);
/* print the message at the center of the screen */
getstr(str);
mvprintw(LINES - 2, 0, "You Entered: %s", str);
getch();
endwin();
return 0;
}