The functions themselves...
`Code by Dgamer
`Read Memblock String
`mnum=Memblock number
`pos=position
`length=string length
function memblockstring(mnum, pos, length)
string$ as string
for x=pos to length
string$=string$+chr$(memblock byte(mnum,x))
next x
endfunction string$
`Writes memblock strings
`mnum=memblock number
`pos=position
`string$=string you wish to write
function writememblockstring(mnum, pos, string$)
endpos=len(string$)+pos
place=1
for x=pos to endpos
write memblock byte mnum, x, asc(mid$(string$,place))
inc place
next x
endfunction
And some examples(Run these two in succession for the whole example)...
Writing memblocks...
`Code by Dgamer
endl as string
endl=chr$(13)+chr$(10)
filename$="TeSt.TxT"
if file exist(filename$)=1
delete file filename$
endif
open to write 1,filename$
make memblock 1,50
text$="I pity the foo"+endl+"who doesn't use memblocks"+endl+"!!!!!"
writememblockstring(1,0,text$)
make file from memblock 1,1
delete memblock 1
function memblockstring(mnum, pos, length)
string$ as string
for x=pos to length
string$=string$+chr$(memblock byte(mnum,x))
next x
endfunction string$
function writememblockstring(mnum, pos, string$)
endpos=len(string$)+pos
place=1
for x=pos to endpos
write memblock byte mnum, x, asc(mid$(string$,place))
inc place
next x
endfunction
And for reading memblocks...
`Code by Dgamer
open to read 1,"test.txt"
make memblock from file 1,1
text 0,0,memblockstring(1,0,get memblock size(1)-1)
wait key
function memblockstring(mnum, pos, length)
string$ as string
for x=pos to length
string$=string$+chr$(memblock byte(mnum,x))
next x
endfunction string$
function writememblockstring(mnum, pos, string$)
endpos=len(string$)+pos
place=1
for x=pos to endpos
write memblock byte mnum, x, asc(mid$(string$,place))
inc place
next x
endfunction
Notice that by reading file strings with memblocks instead of the read string command, you can use 1 text command to display multiple lines of text.(As opposed to 1 text command per line)
Enjoy.
This sig has been dullified!