>> do %test.r
no server name, application run from console
** Script Error: fprint expected fp argument of type: file.
** Where: fprint fp "line one"
if not-equal?
>> type? fp
== port!

> fprint: func [fp[file!] value[string!]]

>> port! = file!
== false

I hope that helps.

Andrew Martin
Awakening the dragon... (in another universe) :-)
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
-><-

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, 2 April 2000 5:33 PM
Subject: [REBOL] [REBOL]Problem with function argument


> Hello All:
> 
> I am getting an error message when attempting
> to pass a value as a argument to a user-defined
> function:
> 
> the error message is:
> fprint expected fp argument of type: file.
> ** Where: fprint fp "line one"
> 
> code follows: thanks in advance to all!!
> tim
> 
> ; first the function
> fprint: func [fp[file!] value[string!]]
> [
>   either not-equal? fp none
>   [
>     write/append fp value
>     write/append fp newline
>   ]
>   [ print value ]
> ]
> fp: none
> ; check for server name in cgi environment variables
> either equal? system/options/cgi/server-name  none
> [ 
>    ; value is empty, presume the script is run from commad line
>    print "no server name, application run from console"
>    fp: open/new/write %hello.htm
> ]
> ; script is invoked via server, yes, I know we need
> ;   a content-header string, etc here.
> [ 
>   prin "Server name: "
>   print system/options/cgi/server-name
> ]
> ; call function
> fprint fp "line one" ; rebol doesn't like this
> ; if the file has been opened, close it
> if not-equal? fp none [close fp]
> 
> 

Reply via email to