user9690943
user9690943

Reputation:

How to draw a line with ncurses?

I know the basics of C++ ncurses, but I do not know how to draw a simple line between two coordinates.

example:

2----------3

How can I accomplish that?

Upvotes: 3

Views: 6612

Answers (1)

hymie
hymie

Reputation: 2058

   int hline(chtype ch, int n);
   int whline(WINDOW *win, chtype ch, int n);

The hline and whline functions draw a horizontal (left to right) line using ch starting at the current cursor position in the window. The current cursor position is not changed. The line is at most n characters long, or as many as fit into the window.

As for the character, you probably want ACS_HLINE, but - would probably work too... perhaps better.

Upvotes: 5

Related Questions