user2661167
user2661167

Reputation: 491

Draw simple box using curses

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();
}

Upvotes: 3

Views: 19107

Answers (1)

Duck
Duck

Reputation: 27562

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;
}

Upvotes: 12

Related Questions