
Matt Doyle wrote:
I didn't know about that, because on win32 there is a problem with deleting open files.
Using the WIN32 call CreateFile specify FILE_ATTRIBUTE_TEMPORARY.
from MSDN -> FILE_ATTRIBUTE_TEMPORARY - A file is being used for temporary storage. File systems avoid writing data back to mass storage if sufficient cache memory is available, because an application deletes a temporary file after a handle is closed. In that case, the system can entirely avoid writing the data. Otherwise, the data is written after the handle is closed.
You still can't delete an open file but you can possibly avoid ever creating the file in the first place..
But then you have to carefully craft the spec, as users may expect to be able to share the file (by name) among processes. There are clearly different use cases for temporary files, so it is important to capture the most important ones.
Ah, that's true. There is a different flag that could be used FILE_FLAG_DELETE_ON_CLOSE which won't delete it until "all" handles to the file are closed but I really can't vouch for it because I haven't used that one. I've no idea what kind of nasty undocumented luggage it brings along with it. Given the source, I like to try it before I believe it ;) Matt
Regards, Stefan
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Scanned by Fortigate {X3BTB534}