FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
strw_convto_flt.c
Go to the documentation of this file.
1
/* strw$ routines for float and double */
2
3
#include "
fb.h
"
4
5
FBCALL
FB_WCHAR
*
fb_FloatToWstr
(
float
num )
6
{
7
FB_WCHAR
*dst, *d;
8
ssize_t len;
9
10
/* alloc temp string */
11
dst =
fb_wstr_AllocTemp
( 7+8 );
12
if
( dst !=
NULL
)
13
{
14
/* convert */
15
FB_WSTR_FROM_FLOAT
( dst, num );
16
17
/* skip the dot at end if any */
18
len =
fb_wstr_Len
( dst );
19
if
( len > 0 )
20
{
21
d = &dst[len-1];
22
if
( *d ==
_LC
(
'.'
) )
23
*d =
_LC
(
'\0'
);
24
}
25
}
26
27
return
dst;
28
}
29
30
FBCALL
FB_WCHAR
*
fb_DoubleToWstr
(
double
num )
31
{
32
FB_WCHAR
*dst, *d;
33
ssize_t len;
34
35
/* alloc temp string */
36
dst =
fb_wstr_AllocTemp
( 16+8 );
37
if
( dst !=
NULL
)
38
{
39
/* convert */
40
FB_WSTR_FROM_DOUBLE
( dst, num );
41
42
/* skip the dot at end if any */
43
len =
fb_wstr_Len
( dst );
44
if
( len > 0 )
45
{
46
d = &dst[len-1];
47
if
( *d ==
_LC
(
'.'
) )
48
*d =
_LC
(
'\0'
);
49
}
50
}
51
52
return
dst;
53
}
rtlib
strw_convto_flt.c
Generated on Thu Jan 23 2014 19:40:13 for FreeBASIC by
1.8.4