libowfat Documentation - fmt.a

fmt_8long - write an octal ASCII representation of an unsigned long integer
fmt_double - write an ASCII representation of a double
fmt_long - write an ASCII representation of a long intege
fmt_minus - write '-' for negative integers
fmt_plusminus - write '+' or '-'
fmt_str - write an ASCII string
fmt_strn - write an ASCII string
fmt_uint - write an ASCII representation of an unsigned integer
fmt_uint0 - write a zero-padded ASCII representation of an unsigned integer
fmt_ulong - write an ASCII representation of an unsigned long integer
fmt_ulong0 - write a zero-padded ASCII representation of an unsigned long integer
fmt_xlong - write a hexadecimal ASCII representation of an unsigned long integer

Table of Contents

Synopsis

#include <fmt.h>
unsigned int fmt_8long(char *dest, unsigned long source);
unsigned int fmt_double(char *dest, double d, int maxlen, int prec);
unsigned int fmt_long(char *dest, unsigned int source);
unsigned int fmt_minus(char *dest, signed int source);
unsigned int fmt_plusminus(char *dest, signed int source);
unsigned int fmt_str(char *dest, const char *source);
unsigned int fmt_strn(char *dest, const char *source, unsigned int maxlen);
unsigned int fmt_uint(char *dest, unsigned int source);
unsigned int fmt_uint0(char *dest, unsigned int source, unsigned int n);
unsigned int fmt_ulong(char *dest, unsigned long source);
unsigned int fmt_ulong0(char *dest, unsigned long source, unsigned int n);
unsigned int fmt_xlong(char *dest, unsigned long source);

Description

fmt_8long writes an ASCII representation ('0' to '7', base 8) of source to dest and returns the number of bytes written. fmt_8long does not append \0. If dest equals FMT_LEN (i.e. is zero), fmt_8long returns the number of bytes it would have written. For convenience, fmt.h defines the integer FMT_8LONG to be big enough to contain every possible fmt_8long output plus \0.

fmt_double writes an ASCII representation ('0' to '9', base 10) of d to dest and returns the number of bytes written. No more than maxlen bytes will be written. prec digits will be written, using scientific notation if necessary. fmt_double does not append \0. If dest equals FMT_LEN (i.e. is zero), fmt_double returns the number of bytes it would have written.

fmt_long writes an ASCII representation ('-' and '0' to '9', base 10) of source to dest and returns the number of bytes written. fmt_long does not append \0. If dest equals FMT_LEN (i.e. is zero), fmt_long returns the number of bytes it would have written. For convenience, fmt.h defines the integer FMT_ULONG to be big enough to contain every possible fmt_ulong output plus \0.

fmt_minus writes '-' if source is negative, nothing otherwise. It returns the number of bytes written. fmt_minus does not append \0. If dest equals FMT_LEN (i.e. is zero), fmt_minus returns the number of bytes it would have written.

fmt_plusminus writes '-' to dest if source is negative, '+' if source is positive, nothing otherwise. It returns the number of bytes written. fmt_plusminus does not append \0. If dest equals FMT_LEN (i.e. is zero), fmt_plusminus returns the number of bytes it would have written.

fmt_str copies all leading nonzero bytes from source to dest and returns the number of bytes it copied. fmt_str does not append \0. If dest equals FMT_LEN (i.e. is zero), fmt_str returns the number of bytes it would have written, i.e. the number of leading nonzero bytes of source.

fmt_strn copies at most maxlen leading nonzero bytes from source to dest and returns the number of bytes it copied. fmt_str does not append \0. If dest equals FMT_LEN (i.e. is zero), fmt_strn returns the number of bytes it would have written.

fmt_uint writes an ASCII representation ('0' to '9', base 10) of source to dest and returns the number of bytes written. fmt_uint does not append \0. If dest equals FMT_LEN (i.e. is zero), fmt_uint returns the number of bytes it would have written. For convenience, fmt.h defines the integer FMT_ULONG to be big enough to contain every possible fmt_uint output plus \0.

fmt_uint0 writes an ASCII representation ('0' to '9', base 10) of source to dest and returns the number of bytes written. The output is padded with '0' bytes until it encompasses at least n bytes, but it will not be truncated if it does not fit. fmt_uint0 does not append \0. If dest equals FMT_LEN (i.e. is zero), fmt_uint0 returns the number of bytes it would have written. For convenience, fmt.h defines the integer FMT_ULONG to be big enough to contain every possible fmt_uint output plus \0.

fmt_ulong writes an ASCII representation ('0' to '9', base 10) of source to dest and returns the number of bytes written. fmt_ulong does not append \0. If dest equals FMT_LEN (i.e. is zero), fmt_ulong returns the number of bytes it would have written. For convenience, fmt.h defines the integer FMT_ULONG to be big enough to contain every possible fmt_ulong output plus \0.

fmt_ulong0 writes an ASCII representation ('0' to '9', base 10) of source to dest and returns the number of bytes written. The output is padded with '0' bytes until it encompasses at least n bytes, but it will not be truncated if it does not fit. fmt_ulong0 does not append \0. If dest equals FMT_LEN (i.e. is zero), fmt_ulong0 returns the number of bytes it would have written. For convenience, fmt.h defines the integer FMT_ULONG to be big enough to contain every possible fmt_ulong output plus \0.

fmt_xlong writes an ASCII representation ('0' to '9' and 'a' to 'f', base 16) of source to dest and returns the number of bytes written. fmt_xlong does not append \0. If dest equals FMT_LEN (i.e. is zero), fmt_xlong returns the number of bytes it would have written. For convenience, fmt.h defines the integer FMT_XLONG to be big enough to contain every possible fmt_xlong output plus \0.

Tino Reichardt <der@mcmilk.de>, Felix von Leitner <der@fefe.de>
Version: 5.2, Date: 2001/05/27