How do I read a line of text printed on a pad in ncurses? I am trying to use the ncurses
function winchnstr
. I am confused about how to use chtype*
in the function. I understand that chtype
is a long int
, but when I use chtype
in my code I get a segment fault. In the below example the long int y
prints 20. I need to be able to read a line of text on the pad. Can someone show me how to do it?
long int p[20];
wmove(pad,prow,ccol);
long int y = winchnstr(pad, p,20)&A_CHARTEXT;
Edit:
Whenever I print the return from the function, I get the number of characters returned. I am confused. How can I turn this into a printable string?
fprintf(file,"%d",y);