1
General / Live forum update
« on: August 05, 2011, 02:36:30 PM »
Wierd watching the forum update as i go from page to page. I like SMF, i must of installed and relooked/themed over 50 SMF forums to date. Keep up the good work.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
These show how to write and read to/from binary files. No checking for the files existence or type is made using fdets.
Note if the file variable fvar is zero then the file does not exist.
@ Write to a named file
Local fname,fvar,fdets,ftypes,fpaths,fnames,fextens
Local findex,n
FileGet(fname,fvar,fdets,ftypes,fpaths,fnames,fextens)
CreateBFile(fvar,findex,n)
WriteBVariable(findex,'hello')
For n=1 to 10
WriteBByte(findex,n)
EndFor
CloseBFile(findex)
@ Read from a named file, assumes format known
Local fname,fvar,fdets,ftypes,fpaths,fnames,fextens
Local findex,n
FileGet(fname,fvar,fdets,ftypes,fpaths,fnames,fextens)
OpenAsBFile(fvar,findex)
ReadBVariable(findex,mess)
For n=1 to 10
ReadBByte(findex,num)
Put num After mess
EndFor
CloseBFile(findex)
The read part i have tried placing it on the home card and on card 2 which is the main working environment. And the 'write' part i have tried placing on an independant button and directly on the Book HNs update button. I remember last night that on one try i got a conflict on 'nVar' as been already used!!?? I could see being used twice but couldn't work out if i should or how to get them to work together.
?