GUILE NCURSES 2.2: An example of getnstr and getch

Previous: , Up: Input functions [Contents][Index]


4.7.3 An example of getnstr and getch

#!/usr/bin/guile
!#
(use-modules (ncurses curses)
 (ice-9 format))
(define stdscr (initscr))
(let* ((mesg "Enter a string: ")
 (len (string-length mesg))
 (siz (getmaxyx stdscr))
 (row (car siz))
 (col (cadr siz)))
 (addstr stdscr mesg
 #:y (round (/ row 2))
 #:x 0)
 (refresh stdscr)
 (let ((str (getnstr stdscr 80)))
 (addstr stdscr
 (format #f "You entered: ~s~%" str)
 #:y (- row 2)
 #:x 0)
 (getch stdscr)))
(endwin)

AltStyle によって変換されたページ (->オリジナル) /