comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Create unique temporary file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Create unique temporary file [message #40676 is a reply to message #40674] Tue, 24 August 2004 22:04 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Michael Wallace writes:

> 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?

Here is how I create a unique journal file name:

Print, String('journal_', Bin_Date(SysTime()), '.pro', $
Format='(A, I4, 5I2.2, A)')

Cheers,

David

P.S. Bin_Date!? What the heck is that!

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Another EPS question
Next Topic: Create unique temporary file

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Nov 30 15:16:53 PST 2025

Total time taken to generate the page: 1.60223 seconds