I have some code below that works fine but only exits out when I do ctrl+z on Linux but not ctrl+d (EOF)? Does it have something to do with ncurses? What should I use instead (ERR?) and why?
#include <stdio.h>
#include <ncurses.h>
#define MAXLINE 10
// count number of chars, once it reaches certain amount
int main (void)
{
//cbreak();
// to open curses terminal
initscr();
int i, c;
// first iteration set to 1
for (i = 0; (c = getch()) != EOF; i++)
{
if (i == (MAXLINE-1))
{
printf("\r\n");
i = -1;
}
}
// to close curses terminal
endwin();
}
Thank you.