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