Create unique temporary file [message #40677] |
Tue, 24 August 2004 21:45  |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
I need some robust way to create a temporary file. The filepath
function will get you part of the way toward this goal since it can
prepend your system's temporary directory to the file name. But you
still have to come up with a good filename.
filename = FilePath('myfile.txt', /TMP)
The above command will do the job if you only have one copy of the
program running. If there are two or more copies of the program
running, or even a single program running in multiple threads, there's a
possibility of collision when two processes or two threads attempt to
use the same temporary filename at the same time.
What I'd like is some way to generate a completely unique filename
except for the extension to reduce the probability of a collision. Any
bright ideas?
-Mike
|
|
|
Re: Create unique temporary file [message #40788 is a reply to message #40677] |
Wed, 25 August 2004 17:34  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Craig Markwardt writes:
> Hey Michael, I'm coming into this late, but I've developed a function
> called CMUNIQUE_ID() which generates unique identifiers.
I spend half the day thinking what a genius programmer
I am (new Annotate capability in my Catalyst Library),
and half the day wondering if anyone will figure out
I don't know beans about programming. :-(
Cheers,
David
P.S. Let's just say *this* is a damn random sequence! :-)
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|