Mail Archives: djgpp/1997/08/03/17:02:13
Burton Radons/Lothloriel, Hollow Dreams wrote:
>
> Base function:
>
> char *rsprintf(const char *format, ...)
> {
> va_list args;
> char *buffer;
> /* and on and on... */
> }
>
> What would I have to do to... err... set 'args' to '...'? That half of the
> reference manual was stolen several years ago, before I could get to it, so
> fluid-depth arguments are still an absolute mystery to me.
The va_args syntax was discussed in detail in the documentation for
DJGPP v1.12, but mysteriously disappeared in the upgrade to v2.x.
However, if you look at the vprintf() function in the docs, you will see
the full syntax for passing variable arguments to the special functions
provided for them.
If you want to see how to use the arguments manually, you will need to
get the library sources and examine src/libc/ansi/stdio/vprintf.c; it's
a bit complicated to explain in a post and I don't fully understand it
myself. :)
So you don't go away empty-handed, here's the basic syntax:
int myprintf( const char *format, ... )
{
va_list args;
int r;
va_start( args, format );
r = vprintf( format, args );
va_end( args );
return r;
}
--
---------------------------------------------------------------------
| John M. Aldrich | "It may be better to be a live jackal|
| aka Fighteer I | than a dead lion, but it is better |
| mailto:fighteer AT cs DOT com | still to be a live lion." |
| http://www.cs.com/fighteer | - Lazarus Long |
---------------------------------------------------------------------
- Raw text -