delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/20/04:48:48

From: ron DOT t DOT lewis AT bbs DOT st DOT net DOT au (Ron T Lewis)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: sprintf() string len
Date: 18 Oct 97 12:04:04
Organization: Soft-Tech +61-7-3869-2666
Lines: 34
Message-ID: <eab_9710201553@softtech.st.net.au>
References: <3 DOT 0 DOT 16 DOT 19971014214406 DOT 2c573b3e AT hem1 DOT passagen DOT se> <3445D623 DOT 605E AT ukc DOT ac DOT uk> <6256nc$jtt$1 AT star DOT cs DOT vu DOT nl> <34465E33 DOT 719A AT cs DOT com> <6268je$a32$1 AT news DOT ox DOT ac DOT uk>
NNTP-Posting-Host: sun.st.net.au
Cache-Post-Path: sun.brisnet.org.au!unknown AT softtech DOT brisnet DOT org DOT au
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019