[REBOL] [REBOL] stand output handle?

2000-03-31 Thread tjohnson

Does rebol have a standard output handle like c?
Example : In "C" I can write something like this:
//===
FILE* f;
IF write_to_file THEN
  f = fopen("test.htm","w")
ELSE
  f = stdout;
ENDIF
fprintf(f,"This could be written to the console\n"
  "OR to the console OR as web content");
// thanks in advance
Tim
BTW, that's not psuedo-code




[REBOL] [REBOL] stand output handle? Re:

2000-03-31 Thread mjelinek

I believe I have seen an example where a port was opened to the console
(input and/or output?). It was probably somewhere on rebol.org. I haven't
played with explicit opens to a file. Does rebol keep a "file handle"
entity, or is it just a port?

I'm going to be doing something very similar to this soon, but my 'either
statement will be doing the actual printing/writing, and so for the "stdout"
part I'll just be using a regular 'print.

Michael Jelinek
IS - Data Warehouse
CalFarm Insurance
[EMAIL PROTECTED]
924-4068

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 31, 2000 9:55 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] [REBOL] stand output handle?


Does rebol have a standard output handle like c?
Example : In "C" I can write something like this:
//===
FILE* f;
IF write_to_file THEN
  f = fopen("test.htm","w")
ELSE
  f = stdout;
ENDIF
fprintf(f,"This could be written to the console\n"
  "OR to the console OR as web content");
// thanks in advance
Tim
BTW, that's not psuedo-code




[REBOL] [REBOL] stand output handle? Re:

2000-03-31 Thread Al . Bri

Tim wrote:
 Does rebol have a standard output handle like c?
 Example : In "C" I can write something like this:
 file://===
 FILE* f;
 IF write_to_file THEN
   f = fopen("test.htm","w")
 ELSE
   f = stdout;
 ENDIF
 fprintf(f,"This could be written to the console\n"
   "OR to the console OR as web content");

Redefining 'print would be the simplest way. Something like this:

either write_to_file [
print: function [value] [
write/append %test.htm value
]
] [
print: get in system/words 'print
]

Andrew Martin
REBOL/View Beta expired! :-(
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--




[REBOL] [REBOL] stand output handle? Re:

2000-03-31 Thread deadzaphod

to open a port to the console just use
  f: open [scheme: 'console]
or
  f: open/binary [scheme: 'console]

and to redefine stdout to any port you want:
  system/ports/output: f

Cal Dixon ([EMAIL PROTECTED])

--

From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [REBOL] [REBOL] stand output handle?
Date: Fri, 31 Mar 2000 8:55:27 -0900

Does rebol have a standard output handle like c?
Example : In "C" I can write something like this:
//===
FILE* f;
IF write_to_file THEN
   f = fopen("test.htm","w")
ELSE
   f = stdout;
ENDIF
fprintf(f,"This could be written to the console\n"
   "OR to the console OR as web content");
// thanks in advance
Tim
BTW, that's not psuedo-code


__
Get Your Private, Free Email at http://www.hotmail.com