Text mode programming ain't dead yet!

Welcome to my NCurses support page, written specifically to support my book, The Programmer's Guide to NCurses, though anyone curious about NCurses is welcome.

Table of Contents

Source Code

Here is a tar.gz file chock full of the book's source code. That's 238 C source code (plain text) files in two directories. The files in the book directory are from the tutorial part of the book. Files in the book-ref directory are the sample files from the reference. The archive uses the same filenames as referenced in the text.

Please let me know if anything is missing or wrong; my e-mail address can be found in the front of the book. Thanks!

Supplemental Information

* Here is a link to a page on using Python with NCurses courtesy of the Npyscreen python widget library and application framework.

* I've received e-mail from a fellow who's created a JavaScript binding to NCurses, implemented on top of the SpiderMonkey JavaScript engine (used by Mozilla/Firefox). By using this binding it makes it easier and faster to write NCurses apps in JavaScript, as well as having several advantages over using C. Check it out at:

* Here's a screen map for you! It can be used to help build menus or plot coordinates on a standard 80x24 screen. PDF format.

* NCruses Colors, hues, and other information. As the book is not in color I wasn't able to include color swatches for the various NCurses color commands. But, hey! The web is in color! So here are those swatches:

Color Function Hue Constant Name
0 init_color(0,0,0,0); COLOR_BLACK
1 init_color(0,1000,0,0); COLOR_RED
2 init_color(0,0,1000,0); COLOR_GREEN
3 init_color(0,1000,1000,0); COLOR_YELLOW
4 init_color(0,0,0,1000); COLOR_BLUE
5 init_color(0,1000,0,1000); COLOR_MAGENTA
6 init_color(0,0,1000,1000); COLOR_CYAN
7 init_color(0,1000,1000,1000); COLOR_WHITE

* It is possible to get more than the standard 8 (or 16) colors out of NCurses, but you must be using a compatible terminal and re-compile NCurses on your computer to include that full color support. Read more...

* A few of the books' figures were done originally in color. Sadly, it's not a four-color book. To see the images in their original color, lookee here.

Bonus Programs

Here is my solution for the dual-window, rot13 program at the end of Chapter 8.

Here is my solution for the clickput.c source code mentioned in Chapter 13.

The gettysburg.txt file used in a few of the sample programs for filling a window with text.


Page 20, first paragraph
The last sentence improperly spells initscr() as inistscr().
Page 75, bottom of the page
stdscr is improperly written as sdtscr. So the code example should be nodelay(stdscr,TRUE)
Page 98, "Dueling Windows" section
You need to call the refresh() command after initscr() in order for the windows to appear. This is apparently a change in Ncurses since the book was written. The change applies to the source code for quad1.c, quad2.c, and quad3.c. Basically, just add a refresh() statement after initscr() in each listing and the programs will run properly.
Page 99
Per the Page 98 errata, a refresh() function call needs to be added after Line 11.
Page 100
A refresh() function call needs to be added after Line 11.
Page 102
A refresh() function call needs to be added after Line 11.
Page 104, first paragraph
There are 26 letters in the alphabet, not 36 as suggested in the text.
Page 110, Listing 9-3, kid3.c
The code as presented in the book doesn't update the subwindows. You can insert a getch() statement before Line 29 to do so. A more elegant solution is to change Line 30 to read wgetch(grandpa), which refreshes that window and updates the screen.
Page 173, Table 14-1
Oops! The double-line drawing characters are missing from the table. What a gross oversight! Here they are:
Char Dec Hex Char Dec Hex
186 0xBA 187 0xBB
205 0xCD 200 0xC8
201 0xC9 188 0xBC
Page 287
The entire getmouse() entry is not properly placed alphabetically in the appendix; it should be on page 284 or just before the getnstr() entry.
Page 352, first paragraph
Replace ROWS with LINES so that the paragraph reads:
LINES is a variable, not a constant. Note that changing the value of LINES does not re-size the standard screen or terminal window.
Page 370
First paragraph below the napms(ms) header: The function measures milliseconds, not microseconds. The difference? About 1,000 microseconds make for one millisecond. Specifically, the descriptive sentence should read:
The napms() function pauses program execution for a given number of milliseconds (1/1000th of a second).
Page 376, second paragraph
The maximum value for ncols is 32767, the same as for nlines and as set by NCURSES_SIZE_T.

Other Resources

GNU NCurses web page - How to get NCurses, options, features, and so on.

Thomas Dickey's NCurses FAQ - General questions about NCurses itself, plus a few links to some How-Tos.