2
votes

I want to save the result of any programming run on GNU/scheme. In order to do this I prepared the following test file(please see below). I was thinking that by running this, a scm file which just contains the word "01234" would be saved in the relevant directory under the name "testfile" but I couldn't find any file although GNU scheme says "done" after running this program. Could anybody kindly tell me what is wrong with this? I am running GNU scheme on windows (downloaded from; http://www.gnu.org/software/mit-scheme/ "I installed windows binary" ) and the directory on my pc where i think the file will be saved is; C:\Program Files (x86)\MIT-GNU Scheme

Below is the content of the test program

(define outport (open-output-file "testfile"))  
(display "abcde" outport)  
(newline outport)  
(display "01234" outport)  
(newline outport)  
(close-output-port outport)

Thank you.

1
Works fine for me (with GNU Guile Scheme). File is created in the current directory, not necessarily the installation directory. Try searching for the file in Explorer, starting from C:\ - uselpa
Thank you very much. I tried to serach the file under C: but I could not find it...Anyway, thanks. - tora chan
oh, I just could find it. It was in a hidden folder. Thank you very much for your help!!!! - tora chan
The file will be called testfile, not testfile.scm, in case you searched for the latter. Otherwise, try to launch the program from a DOS box. The file should be in the current directory then. - uselpa

1 Answers

2
votes

Uselpa's explanation is spot on.

The manual has the following to say:

15.2 Working Directory

When MIT/GNU Scheme is started, the current working directory (or simply, working directory) is initialized in an operating-system dependent manner; usually, it is the directory in which Scheme was invoked. The working directory can be determined from within Scheme by calling the pwd procedure, and changed by calling the cd procedure. Each REP loop has its own working directory, and inferior REP loops initialize their working directory from the value in effect in their superior at the time they are created.

This means that you can use

(pwd)

in the Scheme repl to see where your file is saved.