[comp.lang.c] More on Re: Can ANYONE tell me why this code snippet doesn't work??

wen-king@cit-vlsi.Caltech.Edu (Wen-King Su) (10/18/88)

In article <57@attibr.UUCP> vch@attibr.UUCP (Vincent C. Hatem) writes:
>In article <7778@gryphon.CTS.COM%, rickf@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@vlsi.caltech.edu  Caltech Corp of Cosmic Engineers |
\*------------------------------------------------------------------------*/