summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 24ad982..e82e5fc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,4 +1,5 @@
#include <ncurses.h>
+#include <string.h>
void hello_world() {
initscr();
@@ -8,8 +9,22 @@ void hello_world() {
endwin();
}
+void printw_example(){
+ char mesg[]="Just a string";
+ int row,col;
+ 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();
+}
+
int main(int argc, const char *argv[])
{
hello_world();
+ printw_example();
return 0;
}