We are trying to construct a log file using IronScheme, and we have written a code for it using racket. It works fine in racket, but IronScheme throws an error. This is what we have so far:
(define write-to-log
(lambda(whatToWrite)
(with-output-to-file "robot-log.txt"
(lambda () (printf (string-append whatToWrite "\r\n" ))) #:exists 'append)))
See how we use the "exists" optional parameter when using with-output-to-file. We are not sure how to make this optional parameter work with IronScheme. Are there any ways of getting this to work, or alternative methods?
Please note that we would like to append a string to an existing .txt file. If we don't use the optional argument, an error is thrown saying that the file already exists.