Mail Archives: djgpp/1997/10/20/04:48:48
Hello Merton,
mert0407 AT sable DOT ox DOT ac DOT uk on 10-17-97 Spoke to All about Re: sprintf()
string leng
m>In writing a set of addon routines for Allegro, providing formatted
m>text output a la *printf, I needed something like this; I just used a
m>very large buffer in the end, but I'm changing it to use the fprintf
m>to /dev/nul instead. Presumably hacking through the library sources
m>would also be a solution, extracting what code I needed, but I think
m>it's better to use existing code where possible.
Not sure if this will do what you want, it's a port from Themies XLib.
#include <stdio.h>
#include <stdarg.h>
#include <allegro.h>
void my_printf(int x, int y, BITMAP * bmp, int color, char *ln,...)
{
char dlin[100],*dl=dlin;
va_list ap;
va_start(ap,ln);
vsprintf(dlin,ln,ap);
va_end(ap);
show_mouse(NULL);
textout(bmp, font, dl, x,y,color);
show_mouse(screen);
}
(OH! Well, Lifes like that Sumtimes) Regards Ron T Lewis
Truckin On Web Site http://www.st.net.au/~lewisr
___
X CMPQwk #1.42X UNREGISTERED EVALUATION COPY
- Raw text -