cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
displaying text files on ncurses mode qu
displaying text files on ncurses mode question
Mar 15, 2017 at 9:13pm UTC
jamz123
(2)
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
Mar 18, 2017 at 1:41am UTC
Mar 15, 2017 at 11:26pm UTC
Peter87
(11175)
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
Mar 15, 2017 at 11:48pm UTC
Mar 15, 2017 at 11:52pm UTC
jamz123
(2)
Ah!! i see, it works perfectly. Thank you!
Topic archived. No new replies allowed.