home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 1
/
FishNMoreVol1.bin
/
more
/
code_examples
/
librar
/
ftoa.c
< prev
next >
Wrap
Text File
|
1989-02-08
|
768b
|
32 lines
/*--------------------------------------*/
/* */
/* FTOA(X,X,X) */
/* */
/* Converts a floating point number to */
/* a character array. The first */
/* argument is the floating point */
/* number. The second argument is the */
/* character array and the third */
/* argument is the size of the array. */
/* */
/*--------------------------------------*/
# include "math.h"
void ftoa(dd,a,b)
double dd;
char a[];
int b;
{
char *r;
int d,j;
gcvt(dd,b,r);
d=strlen(r);
if (d<b){
charinit(a,b-d,32);
for (j=b-d;j<b;j++)
a[j]=r[j-b+d];
}
else{
for (j=0;j<b;j++)
a[j]=r[j];
}
}