More on Re: Can ANYONE tell me why this code snippet doesn't work??

Wen-King Su wen-king at cit-vlsi.Caltech.Edu
Tue Oct 18 09:59:59 AEST 1988


In article <57 at attibr.UUCP> vch at attibr.UUCP (Vincent C. Hatem) writes:
>In article <7778 at gryphon.CTS.COM%, rickf at pnet02.cts.com (Rick Flower) writes:
<% I've been trying to get the following code to work.. I've tried just about
>% void Test(fmt,args)
  	stuff deleted
<You aren't passing a POINTER to the arguments, as you seem to think you are.
>this should be (if I'm not mistaken... i haven't tried this lately)
<
>unsigned *args;
<         sprintf(buff,fmt,&args);

Hmm... You must be thinking of the _RISKY_ use of vsprintf for SysV and
compatibles.  Ordinary sprintf won't take that.  There is the good
method and there is the no-so-good method.  I believe someone else has
already posted the good method.  For the no-so-good method, replacing
sprintf with vsprintf above will do the job for most systems, provided
that you have access to the vsprintf function.

Don't flame me for the perpetuation of bad programming practices; like
sex, naive programmers can and will eventually learn everything on their
own, no matter how we hide them. :-)

/*------------------------------------------------------------------------*\
| Wen-King Su  wen-king at vlsi.caltech.edu  Caltech Corp of Cosmic Engineers |
\*------------------------------------------------------------------------*/



More information about the Comp.lang.c mailing list