alias hloadi_test {
if (-* iswm $1 ) var -s %switch $1 | else var -s %switch
hfree -sw test | hfree -sw test2
hmake test
bset &v 1 97 98 99 13 10 100 101 102 61 49 50 51
hadd -b test binary &v
hadd test itema data
hadd test itemz data
echo 3 -a items before save: $hget(test,0).item
noop $hfind(test,*,0,w,echo 3 -a $1 $hget(test,$1))
hsave %switch test test.txt
hmake test2
hload %switch test2 test.txt
echo -a items after load: $hget(test2,0).item
noop $hget(test2,binary,&foo)
echo -a loaded from disk: $bvar(&foo,1-) $bvar(&foo,1-).text
noop $hfind(test2,*,0,w,echo 4 -a $1 $hget(test2,$1))
copy -o test.txt test2.txt
hfree -sw test2
hmake test2
hload %switch test2 test2.txt
echo -a items after load same data from different file: $hget(test2,0).item
noop $hfind(test2,*,0,w,echo 4 -a $1 $hget(test2,$1))
bread test.txt 0 $file(test.txt).size &v
echo -a bread: $replace($regsubex(foo,$bvar(&v,1-),/(\d+)/g,$base(\t,10,16,2)),61 62 63,61 62 63 $chr(22))
}