Line | |
---|
1 | #include <curses.h>
|
---|
2 | #include "curspriv.h"
|
---|
3 |
|
---|
4 | /****************************************************************/
|
---|
5 | /* Wgetstr(win,str) reads in a string (terminated by \n or \r) */
|
---|
6 | /* To the buffer pointed to by 'str', and displays the input */
|
---|
7 | /* In window 'win'. The user's erase and kill characters are */
|
---|
8 | /* Active. */
|
---|
9 | /****************************************************************/
|
---|
10 |
|
---|
11 | int wgetstr(win, str)
|
---|
12 | WINDOW *win;
|
---|
13 | char *str;
|
---|
14 | {
|
---|
15 | while ((*str = wgetch(win)) != ERR && *str != '\n') str++;
|
---|
16 | if (*str == ERR) {
|
---|
17 | *str = '\0';
|
---|
18 | return ERR;
|
---|
19 | }
|
---|
20 | *str = '\0';
|
---|
21 | return OK;
|
---|
22 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.