[REBOL] Antwort: saving blocks--typo correction-excuse me Re:(2)
From: joel:neely:fedex at: 26-Sep-2000 8:39
Hi, Sharriff!
[Sharriff--Aina--med-iq--de] wrote:
> can I just do a READ instead of an OPENT to append another BLOCK to
> block.txt? I´m grinning from ear to ear now...
>
Consider the following:
>> ? write
USAGE:
WRITE destination value /binary /string /direct /append /wait
/lines /part size /with end-of-line /allow access /mode args
/custom params
DESCRIPTION:
Writes to a file, url, or port-spec (block or object).
WRITE is a native value.
ARGUMENTS:
destination -- (Type: file url object block)
value -- (Type: any)
REFINEMENTS:
...[snip]...
/append -- Writes to the end of an existing file.
...[sip]...
and the transcript:
>> foo: [1 2 "buckle" "my" "shoe"]
== [1 2 "buckle" "my" "shoe"]
>> mold foo
== {[1 2 "buckle" "my" "shoe"]}
>> write/append %test.data mold foo
>> foo: [3 4 "shut" "the" "door"]
>> write/append %test.data mold foo
>> print read %test.data
[1 2 "buckle" "my" "shoe"][3 4 "shut" "the" "door"]
>>
And, of course, had I not been too lazy to put newlines after each,
you'd be able to say
all-foo: read/lines %test.data
and get a block of strings, each of which can be turned into a
block.
There's more that could be said, but I hope this helps...
-jn-