---
created_at: '2016-01-17T22:45:50.000Z'
title: Ncurses Programming How to (2005)
url: http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/
author: brudgers
points: 60
story_text: 
comment_text: 
num_comments: 20
story_id: 
story_title: 
story_url: 
parent_id: 
created_at_i: 1453070750
_tags:
- story
- author_brudgers
- story_10921458
objectID: '10921458'

---
[Source](http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/ "Permalink to ")

# NCURSES Programming HOWTO

###  Pradeep Padala 

`<[ppadala@gmail.com][1]>`

v1.9, 2005-06-20  

| ----- |
| **Revision History** | 
| Revision 1.9 | 2005-06-20 | Revised by: ppadala | 
| The license has been changed to the MIT-style license used by NCURSES. Note that the programs are also re-licensed under this. |  | |
| Revision 1.8 | 2005-06-17 | Revised by: ppadala | 
| Lots of updates. Added references and perl examples. Changes to examples. Many grammatical and stylistic changes to the content. Changes to NCURSES history. |  | |
| Revision 1.7.1 | 2002-06-25 | Revised by: ppadala | 
| Added a README file for building and instructions for building from source. |  | |
| Revision 1.7 | 2002-06-25 | Revised by: ppadala | 
| Added "Other formats" section and made a lot of fancy changes to the programs. Inlining of programs is gone. |  | |
| Revision 1.6.1 | 2002-02-24 | Revised by: ppadala | 
| Removed the old Changelog section, cleaned the makefiles |  | |
| Revision 1.6 | 2002-02-16 | Revised by: ppadala | 
| Corrected a lot of spelling mistakes, added ACS variables section |  | |
| Revision 1.5 | 2002-01-05 | Revised by: ppadala | 
| Changed structure to present proper TOC |  | |
| Revision 1.3.1 | 2001-07-26 | Revised by: ppadala | 
| Corrected maintainers paragraph, Corrected stable release number |  | |
| Revision 1.3 | 2001-07-24 | Revised by: ppadala | 
| Added copyright notices to main document (LDP license) and programs (GPL), Corrected printw_example. |  | |
| Revision 1.2 | 2001-06-05 | Revised by: ppadala | 
| Incorporated ravi's changes. Mainly to introduction, menu, form, justforfun sections |  | |
| Revision 1.1 | 2001-05-22 | Revised by: ppadala | 
| Added "a word about window" section, Added scanw_example. |  | |

_This document is intended to be an "All in One" guide for programming with ncurses and its sister libraries. We graduate from a simple "Hello World" program to more complex form manipulation. No prior experience in ncurses is assumed. Send comments to [this address][1] _

* * *

**Table of Contents**
1\. [Introduction][2]
: 

1.1. [What is NCURSES?][3]
1.2. [What we can do with NCURSES][4]
1.3. [Where to get it][5]
1.4. [Purpose/Scope of the document][6]
1.5. [About the Programs][7]
1.6. [Other Formats of the document][8]
1.7. [Credits][9]
1.8. [Wish List][10]
1.9. [Copyright][11]

2\. [Hello World !!!][12]
: 

2.1. [Compiling With the NCURSES Library][13]
2.2. [Dissection][14]

3\. [The Gory Details][15]
4\. [Initialization][16]
: 

4.1. [Initialization functions][17]
4.2. [raw() and cbreak()][18]
4.3. [echo() and noecho()][19]
4.4. [keypad()][20]
4.5. [halfdelay()][21]
4.6. [Miscellaneous Initialization functions][22]
4.7. [An Example][23]

5\. [A Word about Windows][24]
6\. [Output functions][25]
: 

6.1. [addch() class of functions][26]
6.2. [mvaddch(), waddch() and mvwaddch()][27]
6.3. [printw() class of functions][28]
6.4. [addstr() class of functions][29]
6.5. [A word of caution][30]

7\. [Input functions][31]
: 

7.1. [getch() class of functions][32]
7.2. [scanw() class of functions][33]
7.3. [getstr() class of functions][34]
7.4. [Some examples][35]

8\. [Attributes][36]
: 

8.1. [The details][37]
8.2. [attron() vs attrset()][38]
8.3. [attr_get()][39]
8.4. [attr_ functions][40]
8.5. [wattr functions][41]
8.6. [chgat() functions][42]

9\. [Windows][43]
: 

9.1. [The basics][44]
9.2. [Let there be a Window !!!][45]
9.3. [Explanation][46]
9.4. [The other stuff in the example][47]
9.5. [Other Border functions][48]

10\. [Colors][49]
: 

10.1. [The basics][50]
10.2. [Changing Color Definitions][51]
10.3. [Color Content][52]

11\. [Interfacing with the key board][53]
: 

11.1. [The Basics][54]
11.2. [A Simple Key Usage example][55]

12\. [Interfacing with the mouse][56]
: 

12.1. [The Basics][57]
12.2. [Getting the events][58]
12.3. [Putting it all Together][59]
12.4. [Miscellaneous Functions][60]

13\. [Screen Manipulation][61]
: 

13.1. [getyx() functions][62]
13.2. [Screen Dumping][63]
13.3. [Window Dumping][64]

14\. [Miscellaneous features][65]
: 

14.1. [curs_set()][66]
14.2. [Temporarily Leaving Curses mode][67]
14.3. [ACS_ variables][68]

15\. [Other libraries][69]
16\. [Panel Library][70]
: 

16.1. [The Basics][71]
16.2. [Compiling With the Panels Library][72]
16.3. [Panel Window Browsing][73]
16.4. [Using User Pointers][74]
16.5. [Moving and Resizing Panels][75]
16.6. [Hiding and Showing Panels][76]
16.7. [panel_above() and panel_below() Functions][77]

17\. [Menus Library][78]
: 

17.1. [The Basics][79]
17.2. [Compiling With the Menu Library][80]
17.3. [Menu Driver: The work horse of the menu system][81]
17.4. [Menu Windows][82]
17.5. [Scrolling Menus][83]
17.6. [Multi Columnar Menus][84]
17.7. [Multi Valued Menus][85]
17.8. [Menu Options][86]
17.9. [The useful User Pointer][87]

18\. [Forms Library][88]
: 

18.1. [The Basics][89]
18.2. [Compiling With the Forms Library][90]
18.3. [Playing with Fields][91]
18.4. [Form Windows][92]
18.5. [Field Validation][93]
18.6. [Form Driver: The work horse of the forms system][94]

19\. [Tools and Widget Libraries][95]
: 

19.1. [CDK (Curses Development Kit)][96]
19.2. [The dialog][97]
19.3. [Perl Curses Modules CURSES::FORM and CURSES::WIDGETS][98]

20\. [Just For Fun !!!][99]
: 

20.1. [The Game of Life][100]
20.2. [Magic Square][101]
20.3. [Towers of Hanoi][102]
20.4. [Queens Puzzle][103]
20.5. [Shuffle][104]
20.6. [Typing Tutor][105]

21\. [References][106]

* * *

| ----- |
|   |   | [Next][2] | 
|   |   | Introduction | 

[1]: mailto:ppadala%40gmail.com
[2]: http://tldp.org/intro.html
[3]: http://tldp.org/intro.html#WHATIS
[4]: http://tldp.org/intro.html#WHATCANWEDO
[5]: http://tldp.org/intro.html#WHERETOGETIT
[6]: http://tldp.org/intro.html#PURPOSE
[7]: http://tldp.org/intro.html#ABOUTPROGRAMS
[8]: http://tldp.org/intro.html#OTHERFORMATS
[9]: http://tldp.org/intro.html#CREDITS
[10]: http://tldp.org/intro.html#WISHLIST
[11]: http://tldp.org/intro.html#COPYRIGHT
[12]: http://tldp.org/helloworld.html
[13]: http://tldp.org/helloworld.html#COMPILECURSES
[14]: http://tldp.org/helloworld.html#DISSECTION
[15]: http://tldp.org/gory.html
[16]: http://tldp.org/init.html
[17]: http://tldp.org/init.html#ABOUTINIT
[18]: http://tldp.org/init.html#RAWCBREAK
[19]: http://tldp.org/init.html#ECHONOECHO
[20]: http://tldp.org/init.html#KEYPAD
[21]: http://tldp.org/init.html#HALFDELAY
[22]: http://tldp.org/init.html#MISCINIT
[23]: http://tldp.org/init.html#INITEX
[24]: http://tldp.org/awordwindows.html
[25]: http://tldp.org/printw.html
[26]: http://tldp.org/printw.html#ADDCHCLASS
[27]: http://tldp.org/printw.html#AEN298
[28]: http://tldp.org/printw.html#PRINTWCLASS
[29]: http://tldp.org/printw.html#ADDSTRCLASS
[30]: http://tldp.org/printw.html#ACAUTION
[31]: http://tldp.org/scanw.html
[32]: http://tldp.org/scanw.html#GETCHCLASS
[33]: http://tldp.org/scanw.html#SCANWCLASS
[34]: http://tldp.org/scanw.html#GETSTRCLASS
[35]: http://tldp.org/scanw.html#GETSTREX
[36]: http://tldp.org/attrib.html
[37]: http://tldp.org/attrib.html#ATTRIBDETAILS
[38]: http://tldp.org/attrib.html#ATTRONVSATTRSET
[39]: http://tldp.org/attrib.html#ATTR_GET
[40]: http://tldp.org/attrib.html#ATTR_FUNCS
[41]: http://tldp.org/attrib.html#WATTRFUNCS
[42]: http://tldp.org/attrib.html#CHGAT
[43]: http://tldp.org/windows.html
[44]: http://tldp.org/windows.html#WINDOWBASICS
[45]: http://tldp.org/windows.html#LETBEWINDOW
[46]: http://tldp.org/windows.html#BORDEREXEXPL
[47]: http://tldp.org/windows.html#OTHERSTUFF
[48]: http://tldp.org/windows.html#OTHERBORDERFUNCS
[49]: http://tldp.org/color.html
[50]: http://tldp.org/color.html#COLORBASICS
[51]: http://tldp.org/color.html#CHANGECOLORDEFS
[52]: http://tldp.org/color.html#COLORCONTENT
[53]: http://tldp.org/keys.html
[54]: http://tldp.org/keys.html#KEYSBASICS
[55]: http://tldp.org/keys.html#SIMPLEKEYEX
[56]: http://tldp.org/mouse.html
[57]: http://tldp.org/mouse.html#MOUSEBASICS
[58]: http://tldp.org/mouse.html#GETTINGEVENTS
[59]: http://tldp.org/mouse.html#MOUSETOGETHER
[60]: http://tldp.org/mouse.html#MISCMOUSEFUNCS
[61]: http://tldp.org/screen.html
[62]: http://tldp.org/screen.html#GETYX
[63]: http://tldp.org/screen.html#SCREENDUMP
[64]: http://tldp.org/screen.html#WINDOWDUMP
[65]: http://tldp.org/misc.html
[66]: http://tldp.org/misc.html#CURSSET
[67]: http://tldp.org/misc.html#TEMPLEAVE
[68]: http://tldp.org/misc.html#ACSVARS
[69]: http://tldp.org/otherlib.html
[70]: http://tldp.org/panels.html
[71]: http://tldp.org/panels.html#PANELBASICS
[72]: http://tldp.org/panels.html#COMPILEPANELS
[73]: http://tldp.org/panels.html#PANELBROWSING
[74]: http://tldp.org/panels.html#USERPTRUSING
[75]: http://tldp.org/panels.html#PANELMOVERESIZE
[76]: http://tldp.org/panels.html#PANELSHOWHIDE
[77]: http://tldp.org/panels.html#PANELABOVE
[78]: http://tldp.org/menus.html
[79]: http://tldp.org/menus.html#MENUBASICS
[80]: http://tldp.org/menus.html#COMPILEMENUS
[81]: http://tldp.org/menus.html#MENUDRIVER
[82]: http://tldp.org/menus.html#MENUWINDOWS
[83]: http://tldp.org/menus.html#SCROLLMENUS
[84]: http://tldp.org/menus.html#MULTICOLUMN
[85]: http://tldp.org/menus.html#MULTIVALUEMENUS
[86]: http://tldp.org/menus.html#MENUOPT
[87]: http://tldp.org/menus.html#MENUUSERPTR
[88]: http://tldp.org/forms.html
[89]: http://tldp.org/forms.html#FORMBASICS
[90]: http://tldp.org/forms.html#COMPILEFORMS
[91]: http://tldp.org/forms.html#PLAYFIELDS
[92]: http://tldp.org/forms.html#FORMWINDOWS
[93]: http://tldp.org/forms.html#FILEDVALIDATE
[94]: http://tldp.org/forms.html#FORMDRIVER
[95]: http://tldp.org/tools.html
[96]: http://tldp.org/tools.html#CDK
[97]: http://tldp.org/tools.html#DIALOG
[98]: http://tldp.org/tools.html#PERLCURSES
[99]: http://tldp.org/justforfun.html
[100]: http://tldp.org/justforfun.html#GAMEOFLIFE
[101]: http://tldp.org/justforfun.html#MAGIC
[102]: http://tldp.org/justforfun.html#HANOI
[103]: http://tldp.org/justforfun.html#QUEENS
[104]: http://tldp.org/justforfun.html#SHUFFLE
[105]: http://tldp.org/justforfun.html#TT
[106]: http://tldp.org/ref.html

