Logo Search packages:      
Sourcecode: libcaca version File versions  Download package

void caca_printf ( int  x,
int  y,
char const *  format,

Format a string.

This function formats a string at the given coordinates, using the default foreground and background values. The coordinates may be outside the screen boundaries (eg. a negative Y coordinate) and the string will be cropped accordingly if it is too long. The syntax of the format string is the same as for the C printf() function.

x X coordinate.
y Y coordinate.
format The format string to print.
... Arguments to the format string.

Definition at line 534 of file graphics.c.

References caca_putstr().

    char tmp[BUFSIZ];
    char *buf = tmp;
    va_list args;

    if(y < 0 || y >= (int)_caca_height || x >= (int)_caca_width)

    if(_caca_width - x + 1 > BUFSIZ)
        buf = malloc(_caca_width - x + 1);

    va_start(args, format);
#if defined(HAVE_VSNPRINTF)
    vsnprintf(buf, _caca_width - x + 1, format, args);
    vsprintf(buf, format, args);
    buf[_caca_width - x] = '\0';

    caca_putstr(x, y, buf);

    if(buf != tmp)

Generated by  Doxygen 1.6.0   Back to index