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