tldp_test.c (620B)
1 #include <ncurses.h> /* ncurses.h includes stdio.h */ 2 #include <string.h> 3 4 int main() 5 { 6 char mesg[]="Enter a string: "; /* message to be appeared on the screen */ 7 char str[80]; 8 int row,col; /* to store the number of rows and * 9 * the number of colums of the screen */ 10 initscr(); /* start the curses mode */ 11 getmaxyx(stdscr,row,col); /* get the number of rows and columns */ 12 mvprintw(row/2,(col-strlen(mesg))/2,"%s",mesg); 13 /* print the message at the center of the screen */ 14 getstr(str); 15 mvprintw(LINES - 2, 0, "You Entered: %s", str); 16 getch(); 17 endwin(); 18 19 return 0; 20 }