add a scanw example
This commit is contained in:
parent
043fd9555d
commit
6f16800e43
|
@ -0,0 +1,17 @@
|
|||
# a scanw example
|
||||
# reference: http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/scanw.html
|
||||
|
||||
import ../ncurses
|
||||
|
||||
var
|
||||
mesg = "Enter a string: "
|
||||
row: cint
|
||||
col: cint
|
||||
|
||||
let pwin = initscr()
|
||||
getmaxyx(pwin, row, col)
|
||||
mvprintw(row div 2, (cint)((col - mesg.len) div 2), "%s", mesg)
|
||||
getstr(mesg)
|
||||
mvprintw(row - 2, 0, "You Entered: %s", mesg)
|
||||
getch()
|
||||
endwin()
|
Loading…
Reference in New Issue