By default, data is loaded on demand, i.e. whenever data which has not yet been referenced is used for the first time. Loading is limited to the lifetime of this storage object, since the storage object carries the file descriptor with it that is needed to access the data file.
To save changes, call the Commit member. This is the only time that data is written to file - when using a read-only file simply avoid calling Commit.
The LoadFromStream and SaveToStream members can be used to serialize the contents of this storage row using only sequential I/O (no seeking, only read or write calls).
The data storage mechanism implementation provides fail-safe operation: if anything prevents Commit from completing its task, the last succesfully committed version of the saved data will be recovered on the next open. This also includes changes made to the table structure.
The following code creates a view with 1 row and stores it on file:
c4_StringProp pName ("Name"); c4_IntProp pAge ("Age");
c4_Storage storage ("myfile.dat", true); c4_View myView = storage.GetAs("Musicians[Name:S,Age:I]");
myView.Add(pName ["John Williams"] + pAge );