[plt-scheme] Somes troubles with refreshed the input files

From: Ziboon (ziboon at gmail.com)
Date: Mon Apr 28 08:30:38 EDT 2008

Hi,

I have a file : "data.ss" where we can found just this (one constant) :
(Contact 25)

In beginning of my program, I read "data.ss" to load my  constant like this
:
_________________________________
(define NBCONTACT
  (when (file-exists? "data.ss" )
    (call-with-input-file  "data.ss"  (...)
_________________________________

No problems with this. (equal? NBCONTACT 25) --> #t


But I want to add a new contact:
I try this :

(define (reload a)
  (when (file-exists? "data.ss" )
    (call-with-output-file  "data.ss"
      (lambda (p-out)
        (fprintf p-out "(Contact ~a)\n" a)) 'replace)))

reload = replace new value in  data.ss.
I do (reload 98):

And now *if I open *"data.ss",  I can see new values for Contact, I see
(Contact 99)

but if i tell NBCONTACT  I have the old values !!!!! 25

My question is :  How to make a method who refresh or reload  the data.ss
file (without recompil my main )
Because I want create an executable when my program  will be finish !!


Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080428/eefbcb55/attachment.html>

Posted on the users mailing list.