프로그램 사용/ncurses
ncurse example
구차니
2022. 5. 17. 08:17
make menuconfig 하면 먼가 그럴싸하게 그려주는게 ncurses 인데
라이브러리는 curses.h 이다. 찾아보니 New Curses 라서 ncurses라고..
[링크 : https://ko.wikipedia.org/wiki/Ncurses]
좌표만 주면 알아서 써주는 것 같은데
드래그 하면 창 크기 알아서 읽어서 박스 그리는건 어떻게 해야하려나?
/* CURHELLO.C ========== (c) Copyright Paul Griffiths 1999 Email: mail@paulgriffiths.net "Hello, world!", ncurses style. */ #include <stdlib.h> #include <stdio.h> #include <unistd.h> /* for sleep() */ #include <curses.h> int main(void) { WINDOW * mainwin; /* Initialize ncurses */ if ( (mainwin = initscr()) == 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 */ mvaddstr(13, 33, "Hello, world!"); refresh(); sleep(3); /* Clean up after ourselves */ delwin(mainwin); endwin(); refresh(); return EXIT_SUCCESS; } |
[링크 : https://www.paulgriffiths.net/program/c/srcs/curhellosrc.html]
[링크 : http://www.paulgriffiths.net/program/c/curses.php]
API
[링크 : https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/index.html]