[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ncurses + readline
From: |
Gabriel Striewe |
Subject: |
ncurses + readline |
Date: |
Sun, 17 Apr 2005 05:07:40 +0200 |
User-agent: |
Mutt/1.4.2.1i |
Dear List!
I want to use readline within ncurses; searching google and the
list's archives did not turn up anything useful.
I can use:
#include <ncurses.h>
int main()
{
char string[80];
initscr();
raw();
keypad(stdscr, TRUE);
echo();
getstr(string);
printw("%s", string);
refresh();
endwin();
return 0;
}
However, the following does not work as expected. I would like to have
the same effect as in the example above: prompt for a string and echo
the string while typing, only this time with readline support.
#include <ncurses.h>
#include <readline/readline.h>
int main()
{
char *line;
initscr();
raw();
keypad(stdscr, TRUE);
echo();
line = readline (">>> ");
printw("%s", line);
refresh();
endwin();
return 0;
}
This code does give me a prompt, but it does not echo what I am typing,
does not clear the screen as in the example above and does not give me
readline support, either.
Could anybody point me to the right direction? Help greatly appreciated.
Thanks
Gabriel
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- ncurses + readline,
Gabriel Striewe <=