(open "myfile" "a") doesn't work as expe

For the Compleat Fan
Locked
gregben
Posts: 20
Joined: Wed Mar 10, 2004 5:00 pm
Location: San Diego, California, USA

(open "myfile" "a") doesn't work as expe

Post by gregben »

The following code:

Code: Select all

(device (open "myfile" "a"))
(print "This goes in myfile")
(close (device))
(exit)
fails with: value expected : (open "myfile" "a")

when the file "myfile" doesn't exist.
If you use (on Unix):

#touch myfile

And rerun the code above, it works as expected.

I would expect that a file opened for appending with "a"
or "append" would not require preexistence of the
file to start writing to it. This is the common usage,
at least on Unix systems.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

I agree, added an O_CREAT flag to append mode in version 8.5.5

Lutz

Locked