home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
drdobbs
/
1988
/
04
/
holub
/
holub.exm
next >
Wrap
Text File
|
1979-12-31
|
2KB
|
60 lines
#include <stdio.h>
#include <stdarg.h>
printf( fmt, ... )
char *fmt;
{
extern int fputc();
va_list args;
va_start(args, fmt);
idoprnt( fputc, stdout, fmt, args );
}
fprintf( stream, fmt, ... )
FILE *stream;
char *fmt;
{
extern int fputc();
va_list args;
va_start(args, fmt);
idoprnt( fputc, stream, fmt, args );
}
Example 1: Printf and fprintf
#include <stdarg.h>
putstr(c, p)
int c;
char **p;
{
**p = c ;
(*p)++ ;
}
int sprintf( buf, fmt, ... )
FILE *stream;
char *fmt;
{
extern int fputc();
va_list args;
char *start = buf;
va_start(args, fmt);
idoprnt( fputc, &buf, fmt, args );
*buf = '\e0' ;
return buf - start;
}
Example 2: Sprintf