File: foreign_set_get.yab

package info (click to toggle)
yabasic 1%3A2.91.1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,168 kB
  • sloc: ansic: 12,434; sh: 4,417; makefile: 21
file content (25 lines) | stat: -rwxr-xr-x 565 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!./yabasic

# put number into a buffer and read it back
num = 127556
buf1$ = frnbf_alloc$(32)
frnbf_set buf1$,0,"int",num
back = frnbf_get(buf1$,0,"int")
print back, num
if back<>num error "They do not match"

# put number into buffer and buffer into other buffer
buf2$ = frnbf_alloc$(32)
frnbf_set buf2$,16,"int",num
frnbf_set_buffer buf1$,16,buf2$

# read back bunber
buf3$ = frnbf_get_buffer$(buf1$,16)
print buf1$,buf2$,buf3$
back = frnbf_get(buf3$,16,"int")
print back, num
if back<>num error "They do not match"

# clean up
frnbf_free buf1$
frnbf_free buf2$