views:

388

answers:

4

Is there a platform-independent C/C++ library that can draw simple "graphics" in pure ASCII in a console program? For example (VERY roughly) I could call a function in the library like rectangle(3, 6); to get the following output:

******
*    *
******

Ultimately, I would love to be able to plot simple graphs based on input data tables like:

|
|*
|
|  *
|     *
|         *
|                *
|                           *
+---------------------------------

And does anyone know if there is a way to specifically render data plots/graphs in ASCII or UTF8?

+10  A: 

I don't know if its exactly what you're searching for, but this library will render images and viedos to the console.

http://aa-project.sourceforge.net/aalib/

svens
+6  A: 

In addition to aalib there is also libcaca (this one will render in full color)

greg
+4  A: 

From what you have said, you don't need ASCII graphics library as they purpose is to render bitmap into ASCII characters so the look of ASCII data will become 'similar' to the bitmap. For the task you have mentioned consider writing your own library, because:

  1. Your task is not really bitmap rendering
  2. It is not so complicated

If you really want to use ASCII art lib, you may choose a library for graph bitmap rendering and then pass that generated bitmap data to ASCII lib so you will get the output.

Andrejs Cainikovs
+2  A: 

I suppose you can use curses (and derivatives like ncurses).

PhiLho