GIMP just had the same problem and I decided to use open-input-output-file . My solution looks something like this:
(let* ((out (open-input-output-file "file.txt") )) (display "hello world" out) (newline out) (close-output-port out))
I walked through the source of TinyScheme and checked that this function actually calls fopen with "a+" . The file is open for reading and writing. For our purposes, we just want to write, so just ignore reading.
I am writing Script -Fu to write gimp-selection-bounds values ββto a file.
source share