[plt-scheme] Binding display function with outputting to textfile.

From: Jerron St. Armand (jerronman at gmail.com)
Date: Wed Dec 10 13:45:43 EST 2008

This is in regards to using the display function and outputting to a text
file.  What I want to do is only write to this file when the user enters the
function "hello".  I notice a problem from my code below is that when I
close the output port I am not able to write anything else to the file, but
I believe closing the port is when the writing actually happens.

(define o (open-output-file "helloworld.txt"))

(define hello
  (display "hello world" o) )

(close-output-port o)

Why does "hello world" get written to helloworld.txt when I run this, even
though it is within a function, and I never called that function in my
interaction window?

Any help would greatly be appreciated
Jerron St. Armand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20081210/25096d49/attachment.html>

Posted on the users mailing list.