home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_09_04
/
9n04084a
< prev
next >
Wrap
Text File
|
1991-02-18
|
944b
|
40 lines
/********************************************************************/
/* Formatted output functions. Note: the return value */
/* is only good until a form function is used again. */
/********************************************************************/
#ifndef INCLUDE_form
#define INCLUDE_form
#ifndef __STDIO_H
#include <stdio.h>
#endif
static char _form_s[256];
static char *dec(long i,int w=0)
{ sprintf(_form_s, "%*ld", w, i);
return _form_s;
}
static char *hex(int i,int w=0)
{ sprintf(_form_s, "%0*X", (w ? w : sizeof(int)), i);
return _form_s;
}
static char *hex(long i, int w=0)
{ sprintf(_form_s, "%0*X", (w ? w : sizeof(long)), i);
return _form_s;
}
static char *chr(int i,int w=0)
{ sprintf(_form_s, "%*c", w, i);
return _form_s;
}
static char *form(char *f,...)
{ vsprintf(_form_s, f, ...); return _form_s; }
#endif