Getting a safe path for a temporary file

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jan 18 03:26:27 PST 2015


On Saturday, 17 January 2015 at 21:32:18 UTC, Jonathan M Davis 
via Digitalmars-d-learn wrote:
> But I think that what we need is a function in std.stdio (e.g 
> tempFile
> insteaf of tmpfile) which returns an open File with a randomly 
> generated
> name and gives you access to its name rather than using C's 
> tmpfile, which
> does not give you access to the name and deletes the file on 
> you when it's
> closed.

Right - I overlooked this fact. The bad thing is that you might 
even be forced to close the file before another program can open 
it, if either of the programs wants to open it exclusively 
(probably most likely to happen on Windows).


More information about the Digitalmars-d-learn mailing list