This page has been designed specifically for the printed screen. It may look different than the page you were viewing on the web.
Please recycle it when you're done reading.

The URI for this page is { http://cc.byexamples.com }

writting a fun cli apps with ncurses Posted on March 30th

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.

Trackback URL

Some Responses to “writting a fun cli apps with ncurses” :

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

    Commented mypapit on March 30th, 2007.
  2. [...] writting a fun cli apps with ncurses [...]

    Commented Non-blocking user input in loop without ncurses. on April 8th, 2007.
Leave your own comments about this post: