doug edmunds wrote:
> I am stuck.  I have followed along with the "Simple Database" contained in
the Rebol how-to.html file, but I can't manipulate the header object that
save/header load/header creates. I want to make changes and save the data
back, with the header intact.

This should work:
        save/header %cities2.r data header
    BUT it doesn't work correctly as there's a bug in 'save! Have a look at
REBOL/View's help for 'save:

>> help save
USAGE:
    SAVE where value /header header-data

DESCRIPTION:
     Saves a value or a block to a file or url.
     SAVE is a native value.

ARGUMENTS:
     where -- Where to save it. (Type: file url)
     value -- Value to save. (Type: any)

REFINEMENTS:
     /header -- Save it with a header
         header-data -- Header block or object (Type: block object)

With the refinement /header and using an object, 'save saves the data like
this:

>> print read %cities2.r
REBOL
make object! [
    Title: "City data"
    Date: none
; <SNIP!>
    Language: none
    User_Groups: "PDX Vanc"
]

    Note that "make object!" shouldn't be in the REBOL script file!

Here's a quick example:

>> h: make object! [
[    File: %file.r
[    Date: 7/April/2000
[    ]
>> data: [
[    a: 1
[    b: 2
[    c: 3]
== [
    a: 1
    b: 2
    c: 3]
>> save/header %file.r data h
>> print read %file.r
REBOL
make object! [
    File: %file.r
    Date: 7-Apr-2000
]

a: 1
b: 2
c: 3

Note that "make object!" shouldn't be in the 'save-ed file!

CC-ed to feedback and to ally list.

Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
-><-

Reply via email to