Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021226 Debian/1.2.1-9
Hi,
after I upgraded to version 5.3 of ncurses, the getch()-function loops
(wgetch (), _nc_wgetch (), wgetnstr(), wgetch(),..) and finally
segfaults. It is working with stdscr only (see sample below). But my
program uses a FILE* as argument for newterm(), which I get from a file
descriptor of a telnet session (with fdopen).
All has worked well with ncurses 5.2.
The following program outputs -1 (correctly) with ncurses 5.2, but
segfaults with 5.3. The outcommented version with fd 0 (stdscr) works
with both versions:
#include <curses.h>
#include <iostream.h>
int main()
{
FILE* m_pTerm;
if ( !(m_pTerm = fopen("junk.txt", "w+")) )
{
cout << "File open error" << endl;
return 0;
}
// if ( !(m_pTerm = fdopen(0, "w+")) )
// {
// cout << "File open error" << endl;
// return 0;
// }
SCREEN* m_pScreen = newterm("vt100", m_pTerm, m_pTerm);
set_term(m_pScreen);
initscr();
keypad(stdscr, TRUE);
nonl();
cbreak();
noecho();
int n = getch();
cout << "getch() returned " << n << endl;
endwin();
delscreen(m_pScreen);
fclose(m_pTerm);
}
Any explanations and help are highly appreciated.
best regards,
Wolfgang