Prev | Current Page 1383 | Next

Christopher Negus

"Linux Bible, 2008 Edition: Boot up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions"

You can also feed readkey.c
input from stdin using the cat command:
$ cat /etc/passwd | ./readkey
INPUT: root:x:0:0::/root:/bin/bash
characters read: 28
In this case, you see only the first line of /etc/passwd because each line of the file ends with a
newline. It should be clear that programmatically interacting with the command line is simple, but
not terribly user-friendly or attractive.
Creating Text-Mode User Interfaces with ncurses
Screen manipulation libraries such as S-Lang and ncurses create more attractive programs, but, as
you might expect, the tradeoff for a nicer looking interface is more complicated code. ncurses,
which stands for new curses, is free re-implementation of the classic curses UNIX screen-handling
library. The term curses derives from the phrase cursor optimization, which succinctly describes
what the curses library does: compute the fastest way to redraw a text-mode screen and place the
cursor in the proper location.
ncurses provides a simple, high-level interface for screen control and manipulation. It also contains
powerful routines for handling keyboard and mouse input, creating and managing multiple windows,
and using menus, forms, and panels. ncurses works by generalizing the interface between
an application program and the screen or terminal on which it is running.


Pages:
1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395