Ignore:
Timestamp:
Apr 17, 2006, 1:00:10 PM (15 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Fixed C++ printf(), added it in example
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cpp/cucul++.cpp

    r781 r783  
    5353    cucul_putstr(qq, x, y, str);
    5454}
    55 //void  Cucul::printf ( int, int, char const *,...)
     55void    Cucul::printf ( int x , int y , char const * format,...)
     56{
     57    char tmp[BUFSIZ];
     58    char *buf = tmp;
     59    va_list args;
     60
     61    va_start(args, format);
     62#if defined(HAVE_VSNPRINTF)
     63    vsnprintf(buf, get_width() - x + 1, format, args);
     64#else
     65    vsprintf(buf, format, args);
     66#endif
     67    buf[get_width() - x] = '\0';
     68    va_end(args);
     69
     70    putstr(x, y, buf);
     71
     72}
    5673
    5774void    Cucul::clear ()
Note: See TracChangeset for help on using the changeset viewer.