Skip to content

writting a fun cli apps with ncurses

Do you feel like writing a nice CLI Application? Where you can manipulate your text in any position and any combination of colors. There are plenty of CLI apps are nicely build with positioning and colors, such as vim, kismet, irssi, screen etc. You can do it in c/c++ with the help of ncurses library.

Do it with ncurses is not difficult, check out the ncurses programming HowTo. This tutorial was well written, it covers from beginners (hello world example) to advance level (uses widget libraries). It includes also some fun game examples just to illustrate the capabilities of ncurses. I have wrote one after taking two days reading the ebook.

matrix 0.2

Matrix 0.2
A simple matrix animation using ncurses library, license under GNU GPL.


Usage: matrix [option]...
matrix --version
matrix --help

-c [1-7] Color value from 1 to 7, default is 2
-t [string] Text heading for each flow string
-s [1-9] The flow speed, 1 fastest, 9 slowest
-l [1-50] Default have 25 flow strings, you can add more
-b Use black as background
-v Print Version
-h Print Usage

Internal Usage:
q | enter Quit the program
[1-7] Changing color

matrix 0.2 bin
matrix 0.2 source code

To compile the source code, you must have ncurses library installed.

g++ -o matrix{,.cc} -lncurses

For more g++ examples, check out linux.byexamples.com.
To print string in colors without ncurses, here.
To print string at any position without ncurses, here.

Categories: Uncategorized.

Comment Feed

4 Responses

  1. yet another ncurses matrix app. I know where to find a local ncurses programmer now :)

  2. Seems the download urls are linked to empty pages, can you check them?

    havocApril 7, 2009 @ 10:54 am



Some HTML is OK

or, reply to this post via trackback.

Continuing the Discussion

  1. [...] writting a fun cli apps with ncurses [...]

  2. [...] Is there any ways to know what shared library are used by a specific application? We can use ldd. Lets take a simple application for example. I have wrote a fun app uses ncurses library, its call “matrix”. It does nothing but simulate the running characters flow from top to bottom in the movie matrix at your linux console. You may get the source code as well as the binaries at HERE. [...]