On Feb 8, 2010, at 12:06, Andy Wingo wrote: >> But mkstemp doesn't guarantee that no one else will grab the file name >> in between the time mkstemp checks that the file doesn't exist, and when >> you actually open(O_CREAT) it. > > It does. The return value from mkstemp! is a port, and it mutates the > template to give you a file name. See mkstemp(3).
Ah, yes, I was looking at mktemp(3)... *sigh* Too many similarly-named functions. It looks to me like tmpfile still has the advantage that (at least on a POSIX system with local file systems) the file will automatically go away even in the event of ungraceful process termination. You could call unlink from Scheme code, but then you're coding the Scheme application to be dependent on POSIX behavior, versus letting the Windows version of tmpfile help you out. Ken