box-o-sand/curses-practice/basics/printw_example.c

20 lines
442 B
C
Raw Normal View History

#include <ncurses.h>
2009-11-19 00:38:43 +00:00
#include <string.h>
int main()
{
char mesg[] = "Just a string";
int row, col;
2009-11-19 00:38:43 +00:00
initscr();
getmaxyx(stdscr, row, col);
mvprintw(row / 2, (col - strlen(mesg)) / 2, "%s", mesg);
mvprintw(row - 2, 0, "This screen has %d rows and %d columns\n", row, col);
printw("Try resizing your window (if possible) and then run this program again");
refresh();
getch();
endwin();
return 0;
2009-11-19 00:38:43 +00:00
}