Using getnstr from Chicken Scheme ncurses egg
The Chicken Scheme documentation for the ncurses egg says that
you should pass a string to the getnstr
, function, but that doesn't
actually work.
I finally found an example, and after looking at it and figuring out what imports are now required I have a working example of using getnstr from the chicken scheme ncurses egg!
(import ncurses) (import (chicken locative)) (import (chicken string)) (define (get-string max) (let ((buffer (make-string max #\null))) (getnstr (make-locative buffer) max) ;; Delete the #\null characters. (string-translate buffer #\null))) (let ((stdscr (initscr)) (str (get-string 10))) (addstr str) (getch) (write str) (endwin))
Oh, and I added the example to the ncurses egg documentation: getnstr Example.

Comments
Comments powered by Disqus