Reputation: 1148
I am writing a program that requires advanced terminal control that is provided by ncurses but I cannot get my program to print anything to stdscr. For example if I compiled the following code I would not see "Testing.. Testing" on the screen. I have used ncurses before and I have never encountered such a problem. I do not know if this is relevant or not but I am running a fresh install of Debian (I literally installed it a couple of hours ago).
#include <ncurses.h>
int main()
{
initscr();
printw("Testing... Testing");
refresh();
return;
}
Also the above progam was compiled with,
gcc --all-warnings --extra-warnings -std=c11 filename.c -lncurses
Upvotes: 2
Views: 2067
Reputation: 605
If you want to see the text, maybe you should keep the program running when you're printing it.
#include <ncurses.h>
int main()
{
initscr();
printw("Testing... Testing");
refresh();
getch(); // Wait the user input in order to keep the program active and showing text.
endwin(); // Terminate the window to clean all memory allocations.
return;
}
You can get more informations on the ncurses "hello world": http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/helloworld.html
Upvotes: 7