NAME

usenum - format numeric value with an exponent

SYNOPSIS

#include <basic/string.h>
#include <basic/type.h>
#include <basic/generic.h>

int usenum(s, type, generic, sign, pound,
fill, dollar, hasdot, dot)
char *s, fill;
int type, sign, pound, dollar, hasdot, dot;
union generic generic;

DESCRIPTION

Usenum formats the numeric value given by type, generic (see generic(inc)) and stores it in the null-terminated string s according to the remaining arguments.  Usenum returns zero unless the value can not be formatted as specified.  The format is described in printu(io), specifically, the formatting of numeric values with an exponent. 

Sign is an enumerated value which indicates how the sign of the value is to be formatted:

            Sign      Printu sign format
 
0Sign format not specified
1Leading + (plus)
2Trailing - (minus)
3Trailing + (plus)

Pound is the maximum number of positions available for digits including a leading sign and a $ (dollar), if specified, but excluding a decimal point, if specified.  Fill is the character for padding on the left.  If dollar is set, a $ (dollar) is to be included.  If hasdot is set, a decimal point is to be included and dot is the position before which the decimal point is to be located. 

The basic conversion is performed via docvt (see numcvt(io)). 

This function supports printu and does not directly implement any BASIC functions. 

SEE ALSO

generic(inc), numcvt(io), printu(io)

DIAGNOSTICS

Usenum returns one if there is not enough space to format at least one digit, a sign and a $ (dollar), if specified; nevertheless, a valid representation of the value is produced albeit a longer representation than specified. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber