FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
strw_convfrom_uint.c
Go to the documentation of this file.
1
/* valwuint function */
2
3
#include "
fb.h
"
4
5
FBCALL
unsigned
int
fb_WstrToUInt
(
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
p = r;
44
}
45
46
return
wcstoul
( p,
NULL
, radix );
47
}
48
49
FBCALL
unsigned
int
fb_WstrValUInt
(
const
FB_WCHAR
*str )
50
{
51
unsigned
int
val;
52
ssize_t len;
53
54
if
( str ==
NULL
)
55
return
0;
56
57
len =
fb_wstr_Len
( str );
58
if
( len == 0 )
59
val = 0;
60
else
61
val =
fb_WstrToUInt
( str, len );
62
63
return
val;
64
}
rtlib
strw_convfrom_uint.c
Generated on Thu Jan 23 2014 19:40:13 for FreeBASIC by
1.8.4