Draw simple box using curses
15,771
Try this.
#include <ncurses.h>
int main(int argc, char *argv[])
{
initscr();
WINDOW *win = newwin(10,10,1,1);
box(win, '*', '*');
touchwin(win);
wrefresh(win);
getchar();
endwin();
return 0;
}
Related videos on Youtube
Author by
user2661167
Updated on June 04, 2022Comments
-
user2661167 almost 2 years
Just started to learn C and got a project using curses. I can't even get the simplest things to draw right now.
Want to do a box and have the following code and it doesn't work. The screens is just black.
What am I doing wrong?
#include <curses.h> int main() { initscr(); noecho(); crmode(); WINDOW * win = newwin(10, 10, 1, 1); wrefresh(win); refresh(); getch(); endwin(); }
-
sukhvir over 10 yearscould you elaborate on the problem. Is there a compiler issue? Or you are not getting the desired output?
-
user2661167 over 10 yearsBTW I don't know if I'm even using the right function. I need a box so maybe box() is better. I'm just struggling to under stand curses right now.
-
user2661167 over 10 yearsNo output at all bust a black screen until I hit a key and the program ends.
-