/* Example of standard and raw input in Curses package. */ #include <curses.h> main() { WINDOW *win1; char vert = '.', hor = '.', str[80]; /* Initialize standard screen, turn echo off. */ initscr(); noecho(); /* Define a user window. */ win1 = newwin(22, 78, 1, 1); leaveok(win1, TRUE); leaveok(stdscr, TRUE); box(stdscr, vert, hor); /* Reset the video, refresh(redraw) both windows. */ mvwaddstr(win1, 2, 2, "Test line terminated input"); wrefresh(win1); /* Do some input and output it. */ nocrmode(); wgetstr(win1, str); mvwaddstr(win1, 5, 5, str); mvwaddstr(win1, 7, 7, "Type something to clear screen"); wrefresh(win1); /* Get another character then delete the window. */ wgetch(win1); wclear(win1); mvwaddstr(win1, 2, 2, "Test raw input"); wrefresh(win1); /* Do some raw input 5 chars or timeout and output it. */ raw(); getstr(str); noraw(); mvwaddstr(win1, 5, 5, str); mvwaddstr(win1, 7, 7, "Raw input completed"); wrefresh(win1); endwin(); }