FB II COMPILER
Write multiple edit fields on disk
Actually this isn't quite as simple as saving records. Since the fields can vary in length, you will probably have to store the length info in the file just before you write the field. Then you can use the READ FILE statement to read the info back.
An partial example someone else could probably do a better job of: (assuming handle& is an edit field handle)
size = FN GETHANDLESIZE(handle&)
WRITE FILE#1, [handle&],size
Go on to the next one.
Then to read it back, you have to first read the length info back, otherwise you don't know how much to read back in. Something along these lines should work.
Y And then the next record.
Failing this, you can try using multiple WRITE FIELDs (see the reference book) which may actually do that stuff for you. Then you could use it the same as any other write or print# statement.
And so forth for read. I'm not sure if this is really allowed in FB though.
LOCAL FN WriteEditField(efID, fileID)
'Writes the contents of edit field #edID
'to the (open) file whose ID number is fileID
DIM textH&, OSErr
textH& = FN TEGETTEXT(TEHANDLE(efID))
OSErr = FN HLOCK(textH&)
WRITE FILE #fileID, [textH&], FN GETHANDLESIZE(textH&)
OSErr = FN HUNLOCK(textH&)