[prev in list] [next in list] [prev in thread] [next in thread] 

List:       racket-users
Subject:    [plt-scheme] Somes troubles with refreshed the input files
From:       ziboon () gmail ! com (Ziboon)
Date:       2008-04-28 12:30:38
Message-ID: 45bb82cc0804280530n5c89ace8q30ade9062f08f823 () mail ! gmail ! com
[Download RAW message or body]

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>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic