Presentation is loading. Please wait.

Presentation is loading. Please wait.

NCurses Tutorial Filiz Şenyüzlüler Güzelbey. What is nCurses? Ncurses is a library, which is used for creating and using windows, screen painting and.

Similar presentations


Presentation on theme: "NCurses Tutorial Filiz Şenyüzlüler Güzelbey. What is nCurses? Ncurses is a library, which is used for creating and using windows, screen painting and."— Presentation transcript:

1 nCurses Tutorial Filiz Şenyüzlüler Güzelbey

2 What is nCurses? Ncurses is a library, which is used for creating and using windows, screen painting and using function keys for text-based terminals.

3 What is nCurses? What you can do with Ncurses: – Use any part of the screen according to your request. – Create and manage windows. – Use 8 different colors. – Use the function keys on the keyboard.

4 Getting Ready Add #include Open Terminal (Compile & Run from Terminal)

5 Basic Functions initscr(); – initializes the terminal in curses mode. – it clears the screen and presents a blank screen. printw("Hello World !!!"); refresh() checks the window and updates only the portion which has been changed. endwin() frees the memory taken by curses sub-system and its data structures and puts the terminal in normal mode.

6 Hello World !!

7 Hello World !! (2)

8 Using Terminal cd Desktop (to reach the file-path) cd foldername g++ filename.cpp –lncurses (to compile)./a.out (to run)

9 Basic Functions getch() – Waits for user input clear() – Clears the screen

10 clearing the screen

11 attributes attributes are used to print characters with some special effects. attron(), attroff() can be used to switch attributes on/off

12 A_BOLD attron(A_BOLD); printw("%c", ch); attroff(A_BOLD);

13 COLOR_PAIR(n) start_color(); /* Start color*/ init_pair(1, COLOR_RED, COLOR_GREEN) ; attron(COLOR_PAIR(1)); printw("%c", ch); attroff(COLOR_PAIR(1));


Download ppt "NCurses Tutorial Filiz Şenyüzlüler Güzelbey. What is nCurses? Ncurses is a library, which is used for creating and using windows, screen painting and."

Similar presentations


Ads by Google