[REBOL] Re: Same block, different formats
From: carl:cybercraft at: 14-Oct-2001 15:41
On 14-Oct-01, Donald Dalley wrote:
> Hi:
> I have REBOL read a directory, to get a block of file names. I want
> to make two different uses of that file list.
> When the block is printed to the console, the list of names is
> separated by a space. The rest of the script interprets the block of
> names, in memory, as having separate elements, too, so the script
> works.
> "A AA AAC AAPL ABC ABF ABGX ABI ABK ABS ABT ABX ACK ACV..."
> When the block is written to a file and that file is read with a
> text reader or editor, though, the names are one long, continuous
> string. This format is obviously useless to me.
> "AAAAACAAPLABCABFABGXABIABKABSABTABXACKACV..."
> Why, and what can I do to ensure that the written block is space
> separated? The only difference is in how the block is presented. In
> both cases, the block is the same block.
Use 'save (and 'load) instead of 'write (and 'read) to preserve your
data's format...
>> write %test.txt [%aaa %bbb %ccc]
>> read %test.txt
== "aaabbbccc"
>> save %test.txt [%aaa %bbb %ccc]
>> load %test.txt
== [%aaa %bbb %ccc
]
--
Carl Read