FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
strw_ftoa.c
Go to the documentation of this file.
1
/* float to wstring, internal usage */
2
3
#include "
fb.h
"
4
5
FB_WCHAR
*
fb_FloatExToWstr
(
double
val,
FB_WCHAR
*
buffer
,
int
digits,
int
mask )
6
{
7
FB_WCHAR
*
p
;
8
ssize_t len;
9
10
if
( mask &
FB_F2A_ADDBLANK
)
11
p = &buffer[1];
12
else
13
p =
buffer
;
14
15
swprintf
( p, 16+8+1,
_LC
(
"%.*g"
), digits, val );
16
17
len =
fb_wstr_Len
( p );
18
19
if
( len > 0 )
20
{
21
/* skip the dot at end if any */
22
if
( len > 0 )
23
if
( p[len-1] ==
_LC
(
'.'
) )
24
p[len-1] =
_LC
(
'\0'
);
25
}
26
27
/* */
28
if
( (mask & FB_F2A_ADDBLANK) > 0 )
29
{
30
if
( *p !=
_LC
(
'-'
) )
31
{
32
*buffer =
_LC
(
' '
);
33
return
buffer
;
34
}
35
else
36
return
p
;
37
}
38
else
39
return
p
;
40
41
}
rtlib
strw_ftoa.c
Generated on Thu Jan 23 2014 19:40:13 for FreeBASIC by
1.8.4