FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
strw_convfrom_ulng.c
Go to the documentation of this file.
1
/* valwulng function */
2
3
#include "
fb.h
"
4
5
FBCALL
unsigned
long
long
fb_WstrToULongint
(
const
FB_WCHAR
*src, ssize_t len )
6
{
7
const
FB_WCHAR
*
p
, *r;
8
int
radix;
9
10
/* skip white spc */
11
p =
fb_wstr_SkipChar
( src, len, 32 );
12
13
len -=
fb_wstr_CalcDiff
( src, p );
14
if
( len < 1 )
15
return
0;
16
17
radix = 10;
18
r =
p
;
19
if
( (len >= 2) && (*r++ == L
'&'
) )
20
{
21
switch
( *r++ )
22
{
23
case
L
'h'
:
24
case
L
'H'
:
25
radix = 16;
26
break
;
27
case
L
'o'
:
28
case
L
'O'
:
29
radix = 8;
30
break
;
31
case
L
'b'
:
32
case
L
'B'
:
33
radix = 2;
34
break
;
35
36
default
:
/* assume octal */
37
radix = 8;
38
r--;
39
break
;
40
}
41
42
if
( radix != 10 )
43
{
44
#ifdef HOST_MINGW
45
return
fb_WstrRadix2Longint
( r, len -
fb_wstr_CalcDiff
( p, r ), radix );
46
#else
47
p = r;
48
#endif
49
}
50
}
51
52
return
wcstoull
( p,
NULL
, radix );
53
}
54
55
FBCALL
unsigned
long
long
fb_WstrValULng
(
const
FB_WCHAR
*str )
56
{
57
unsigned
long
long
val;
58
ssize_t len;
59
60
if
( str ==
NULL
)
61
return
0;
62
63
len =
fb_wstr_Len
( str );
64
if
( len == 0 )
65
val = 0;
66
else
67
val =
fb_WstrToULongint
( str, len );
68
69
return
val;
70
}
rtlib
strw_convfrom_ulng.c
Generated on Thu Jan 23 2014 19:40:13 for FreeBASIC by
1.8.4