-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_ncurses.cpp
More file actions
50 lines (36 loc) · 923 Bytes
/
test_ncurses.cpp
File metadata and controls
50 lines (36 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h> /* for sleep() */
#include <curses.h>
int main(void) {
WINDOW * mainwin = initscr();
/* Initialize ncurses */
if ( mainwin == NULL ) {
fprintf(stderr, "Error initialising ncurses.\n");
exit(EXIT_FAILURE);
}
/* Display "Hello, world!" in the centre of the
screen, call refresh() to show our changes, and
sleep() for a few seconds to get the full screen effect */
addstr("Welcome");
refresh();
sleep(3);
mvaddstr(1, 5, "x");
mvaddstr(1, 2, "x");
mvaddstr(2, 4, "x");
mvaddstr(3, 1, "x");
refresh();
sleep(3);
clear();
mvaddstr(1, 6, "x");
mvaddstr(1, 3, "x");
mvaddstr(2, 5, "x");
mvaddstr(3, 2, "x");
refresh();
sleep(3);
/* Clean up after ourselves */
delwin(mainwin);
endwin();
refresh();
return EXIT_SUCCESS;
}