FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
qb_str_convto.c
Go to the documentation of this file.
1
/* QB compatible str$ routines for int, uint
2
*
3
* the result string's len is being "faked" to appear as if it were shorter
4
* than the one that has to be allocated to fit _itoa and _gvct buffers.
5
*/
6
7
#include "
fb.h
"
8
9
10
/*:::::*/
11
FBCALL
FBSTRING
*
fb_IntToStrQB
(
int
num )
12
{
13
FBSTRING
*dst;
14
15
/* alloc temp string */
16
dst =
fb_hStrAllocTemp
(
NULL
,
sizeof
(
int
) * 3 );
17
if
( dst !=
NULL
)
18
{
19
/* convert */
20
sprintf( dst->
data
,
"% d"
, num );
21
fb_hStrSetLength
( dst, strlen( dst->
data
) );
22
}
23
else
24
dst = &
__fb_ctx
.
null_desc
;
25
26
return
dst;
27
}
28
29
/*:::::*/
30
FBCALL
FBSTRING
*
fb_UIntToStrQB
(
unsigned
int
num )
31
{
32
FBSTRING
*dst;
33
34
/* alloc temp string */
35
dst =
fb_hStrAllocTemp
(
NULL
,
sizeof
(
int
) * 3 );
36
if
( dst !=
NULL
)
37
{
38
/* convert */
39
sprintf( dst->
data
,
" %u"
, num );
40
fb_hStrSetLength
( dst, strlen( dst->
data
) );
41
}
42
else
43
dst = &
__fb_ctx
.
null_desc
;
44
45
return
dst;
46
}
rtlib
qb_str_convto.c
Generated on Thu Jan 23 2014 19:40:12 for FreeBASIC by
1.8.4