Temporary files & folders on Windows
Posted
by
GRIGORE-TURBODISEL
on Stack Overflow
See other posts from Stack Overflow
or by GRIGORE-TURBODISEL
Published on 2012-06-23T22:21:29Z
Indexed on
2012/06/24
9:16 UTC
Read the original article
Hit count: 217
Emulating multithreading by loading a DLL multiple times (it's designed for this). Since LoadLibrary()
doesn't really allow it, the DLL copies itself into a temporary file, via GetTempPath()
and GetTempFileName()
.
It's a small file and upon thread destruction it frees the library and deletes the temporary file. Problem now is that the number of threads is configurable (maniacs can pick 50, 100, more) which basically exposes the risk of running unstable, crash and not go through the usual "delete temporary files" routine.
Is it okay if I just leave those temporary files to die there? Does the OS usually clean the up by itself? Or should I write an autocleanup routine? If yes, how can I go about saving another temporary file to hold a list with those files, and not hit UAC restrictions or otherwise?
Any ideas?
© Stack Overflow or respective owner