Re: Saving a sequence
- Posted by ghaberek (admin) Jan 23, 2015
- 1343 views
GreenEuphorian said...
A recent contribution to the Archive (the XML-to-sequence library) made me wonder about the ways of saving sequences to disk, for later retrieval. Is there a standard way of doing it? And is there anything like sequence-to-XML or similar?
Euphoria has built-in serialization routines. I would say this is the "standard" way of doing so.
These routines are (basically) what EDS uses to store objects in database files, which is also a "standard" way of storing a lot of Euphoria objects on disk in an organized manner.
integer fh fh = open("cust.dat", "wb") puts(fh, serialize(FirstName)) puts(fh, serialize(LastName)) puts(fh, serialize(PhoneNumber)) puts(fh, serialize(Address)) close(fh) fh = open("cust.dat", "rb") FirstName = deserialize(fh) LastName = deserialize(fh) PhoneNumber = deserialize(fh) Address = deserialize(fh) close(fh)
-Greg