libcaca-tutorial.3caca - Man Page


libcaca-tutorial ā€” A libcaca tutorial

First, a very simple working program, to check for basic libcaca functionalities.

#include <caca.h>

int main(void)
    caca_canvas_t *cv; caca_display_t *dp; caca_event_t ev;

    dp = caca_create_display(NULL);
    if(!dp) return 1;
    cv = caca_get_canvas(dp);

    caca_set_display_title(dp, "Hello!");
    caca_set_color_ansi(cv, CACA_BLACK, CACA_WHITE);
    caca_put_str(cv, 0, 0, "This is a message");
    caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1);

    return 0;

What does it do?

You can then compile this code on an UNIX-like system using the following commans (requiring pkg-config and gcc):

gcc `pkg-config --libs --cflags caca` example.c -o example


Wed Mar 20 2024 00:00:00 Version 0.99.beta20 libcaca