output redirect to variable
[1/6] from: nicholas_henry::yahoo::ca at: 29-Dec-2002 19:01
All,
Is there a way to save (redirect) output to a word? For example:
>> ;line of code would be place here to redirect the output buffer to the
word "saved-output"
>> print "hello world"
>> ;line of code that would be return output to console
>> print saved-output
hello world
>>
For those who know ColdFusion -- I am trying to replicate the cfsavecontent
tag.
Thanks in advance.
Nicholas Henry
[2/6] from: ammon:addept:ws at: 29-Dec-2002 19:00
System/Ports/Output is the port that sends the output to the console so if
you redifine it something like
system/ports/output: %/usr/home/my-folder/output.r
then REBOL will send everything that would've gone to the console to that
file. Now, I am not a port expert or I would tell you how to do that so
that it was writing to a word rather than to file, maybe some the port gurus
hanging around will step in and save the day?
HTH
Ammon Johnson
CIO of Addept ---------- (www.addept.ws)
435.616.2322 ---------- (ammon AT addept.ws)
[3/6] from: dockimbel:free at: 30-Dec-2002 3:52
Hi,
Have a look at this script :
http://www.reboltech.com/library/html/capture.html
HTH,
-DocKimbel
Nicholas Henry wrote:
[4/6] from: al:bri:xtra at: 30-Dec-2002 15:32
Nicholas wrote:
> Is there a way to save (redirect) output to a word? For example:
> >> ;line of code would be place here to redirect the output buffer to the
<<quoted lines omitted: 5>>
> >>
> For those who know ColdFusion -- I am trying to replicate the
cfsavecontent
> tag.
Here's one way to save console output to file:
>> help echo
USAGE:
ECHO target
DESCRIPTION:
Copies console output to a file.
ECHO is a function value.
ARGUMENTS:
target -- (Type: file none)
(SPECIAL ATTRIBUTES)
catch
Another way is like:
>> print X: rejoin ["Then answer is: " 1 + 5]
Then answer is: 6
>> print X
Then answer is: 6
I hope that helps!
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[5/6] from: ammon:addept:ws at: 29-Dec-2002 20:32
Uh, I didn't test that. ;-)
system/ports/output: open %/usr/home/my-folder/output.r
ENjoy!!
Ammon Johnson
CIO of Addept ---------- (www.addept.ws)
435.616.2322 ---------- (ammon AT addept.ws)
[6/6] from: rebol-list2:seznam:cz at: 3-Jan-2003 13:27
Hello Ammon,
Monday, December 30, 2002, 4:32:09 AM, you wrote:
AJ> Uh, I didn't test that. ;-)
AJ> system/ports/output: open %/usr/home/my-folder/output.r
make your own port with 'insert handler which prints something, then
set it as system/ports/output and you have very nice CPU killer:)
=( Oliva David )=======================( [oliva--david--seznam--cz] )==
=( Earth/Europe/Czech_Republic/Brno )=============================
=( coords: [lat: 49.22 long: 16.67] )=============================
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted