working through C version of scanw example (7.4)

cat-town
Dan Buch 15 years ago
parent b13831dc92
commit 791b8d227c

@ -1,20 +1,19 @@
#include <ncurses.h> /* ncurses.h includes stdio.h */
#include <ncurses.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();
char * mesg = "Enter a string: ";
char str[80];
int row, col;
return 0;
initscr();
getmaxyx(stdscr, row, col);
mvprintw(row / 2, (col - strlen(mesg)) / 2, "%s", mesg);
getstr(str);
mvprintw(LINES - 2, 0, "You Entered: %s", str);
getch();
endwin();
return 0;
}

Loading…
Cancel
Save