Code: Select all
data "Theatre Powder Rose",226,212,212,_
"Lotus Pink",234,208,214,_
"Ice Pink",241,225,224,_
"Cake Frosting",249,223,229,_
"Arrowhead White",249,234,235
type colorlist_type
n as long
s as string
r as ubyte
g as ubyte
b as ubyte
end type
'common shared as colorlist_type ptr ru_cnlist
dim shared as colorlist_type ptr ru_cnlist
sub ru_colorretrieve()
dim as long ndx
dim as colorlist_type colornamelist(0 to 5)
ndx = 0
do
ndx += 1
colornamelist(ndx).n = ndx
read colornamelist(ndx).s
read colornamelist(ndx).r
read colornamelist(ndx).g
read colornamelist(ndx).b
loop while ndx <> 5
print colornamelist(ndx).n; " + "; colornamelist(ndx).s; " + "; colornamelist(ndx).r;_
" + "; colornamelist(ndx).g; " + "; colornamelist(ndx).b
ru_cnlist = @colornamelist(0)
print ru_cnlist[5].n; " + "; ru_cnlist[5].s; " + "; ru_cnlist[5].r;_
" + "; ru_cnlist[5].g; " + "; ru_cnlist[5].b
print " *** end sub ***"
sleep
end sub ' ru_colorretrieve
dim as long nnn
dim as ubyte cr, cg, cb
dim as string cname
print "before"
ru_colorretrieve()
print "after"
' Arrowhead White --r 249 --g 234 --b 235
nnn = ru_cnlist[5].n
cname = ru_cnlist[5].s
cr = ru_cnlist[5].r
cg = ru_cnlist[5].g
cb = ru_cnlist[5].b
print " index: "; nnn
sleep
print " name: "; cname, " --len: "; len(cname)
sleep
print " red: "; cr
sleep
print " green: "; cg
sleep
print " blu: "; cb
print
FreeBASIC Compiler - Version 1.07.0 (05-20-2019), built for linux-x86_64 (64bit)
Notice cname length with and without [ -exx ]
david