User Tools

Site Tools


savebuffer_save_a_copy_of_the_record_buffer_.htm
Navigation:  ABC Library Reference > FileManager > FileManager Methods >====== SaveBuffer (save a copy of the record buffer) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

SaveBuffer

blk2blue.jpg

The SaveBuffer method saves a copy of the managed file's record buffer contents (the Buffer property) and returns a number that uniquely identifies the saved record. SaveBuffer stores buffer contents for subsequent retrieval by the RestoreBuffer method.

Implementation:

SaveBuffer saves MEMO contents as well as other fields.

SaveBuffer allocates memory which is subsequently released by the RestoreBuffer method. Therefore, to prevent a memory leak, each call to SaveBuffer should be paired with a corresponding call to RestoreBuffer.

Return Data Type:     USHORT

Example:

FileManager.SaveFile PROCEDURE

Id LONG,AUTO

I  SHORT,AUTO

 CODE

   Id = RECORDS(SELF.Saved)

   IF Id

     GET(SELF.Saved,Id)

     ASSERT(~ERRORCODE())

     Id = SELF.Saved.Id + 1

   ELSE

     Id = 1

   END

   SELF.Saved.Id = Id

   SELF.Saved.Buffer = SELF.SaveBuffer()

   SELF.Saved.Key &= SELF.File{PROP:CurrentKey}

   SELF.Saved.WHeld = SELF.File{PROP:Held}

   SELF.Saved.WWatch = SELF.File{PROP:Watched}

   IF SELF.Saved.Key &= NULL

     SELF.Saved.Pos = POSITION(SELF.File)

   ELSE

     SELF.Saved.Pos = POSITION(SELF.Saved.Key)

   END

   ADD(SELF.Saved)

   RETURN Id

See Also:     Buffer, Buffers, RestoreBuffer

savebuffer_save_a_copy_of_the_record_buffer_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1