displaying text files on ncurses mode question

Hi I'm trying to display text files in ncurses mode
sometimes it displays the right contents, but sometimes it displays some broken words like ?^Fms?^Fm.
I am new to ncurses... and I honestly do not know what is wrong...
Last edited on
The argument that you pass to printw is supposed to be a null terminated string. Try using addch instead.

1
2
printw(&x);
addch(x);

http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/printw.html#ADDCHCLASS


EDIT: You can use printw but then you have to pass a string containing the %c format specifier as the first argument and x as the second argument.

 
printw("%c", x);

printw is used the same way as printf: http://www.cplusplus.com/reference/cstdio/printf/
Last edited on
Ah!! i see, it works perfectly. Thank you!
Topic archived. No new replies allowed.