FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
str_fill.c
Go to the documentation of this file.
1
/* string$ function */
2
3
#include "
fb.h
"
4
5
FBCALL
FBSTRING
*
fb_StrFill1
( ssize_t cnt,
int
fchar )
6
{
7
FBSTRING
*dst;
8
9
if
( cnt > 0 )
10
{
11
/* alloc temp string */
12
dst =
fb_hStrAllocTemp
(
NULL
, cnt );
13
if
( dst !=
NULL
)
14
{
15
/* fill it */
16
memset( dst->
data
, fchar, cnt );
17
/* null char */
18
dst->
data
[cnt] =
'\0'
;
19
}
20
else
21
dst = &
__fb_ctx
.
null_desc
;
22
}
23
else
24
dst = &
__fb_ctx
.
null_desc
;
25
26
return
dst;
27
}
28
29
FBCALL
FBSTRING
*
fb_StrFill2
( ssize_t cnt,
FBSTRING
*src )
30
{
31
FBSTRING
*dst;
32
int
fchar;
33
34
if
( (cnt > 0) && (src !=
NULL
) && (src->
data
!=
NULL
) && (
FB_STRSIZE
( src ) > 0) ) {
35
fchar = src->
data
[0];
36
dst =
fb_StrFill1
( cnt, fchar );
37
}
38
else
39
dst = &
__fb_ctx
.
null_desc
;
40
41
/* del if temp */
42
fb_hStrDelTemp
( src );
43
44
return
dst;
45
}
rtlib
str_fill.c
Generated on Thu Jan 23 2014 19:40:13 for FreeBASIC by
1.8.4