Here's a function based on Gregg's code. Do you see any way to improve it?
rebol[]
prepend: func [
{
Inserts a value to the head of a file and returns the head.
Usage: prepend file value-to-prepend
}
file [file!]
value [any-type!]
][
close insert open file value
]
prepend %pig.txt newline
prepend %pig.txt " day!"
prepend %pig.txt "Have a good"
prepend %pig.txt reduce ["Another line." newline]
prepend %pig.txt reduce [now newline]
print read %pig.txt
At 11:54 AM 8/15/2002 +0200, you wrote:
>or watch out the %values.r of Andrew Martin for the PUSH function..
>
>
>----- Original Message -----
>From: "Gregg Irwin" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Thursday, August 15, 2002 7:03 AM
>Subject: [REBOL] Re: Reverse append refinement for write
>
>
> > Hi Louis
> >
> > << How can I append a string to the beginning of a file instead of to its
> > end? >>
> >
> > How about this?
> >
> > close insert open %test.txt reduce [now newline]
> >
> > --Gregg
> >
> > --
> > To unsubscribe from this list, please send an email to
> > [EMAIL PROTECTED] with "unsubscribe" in the
> > subject, without the quotes.
> >
>
>--
>To unsubscribe from this list, please send an email to
>[EMAIL PROTECTED] with "unsubscribe" in the
>subject, without the quotes.
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.