3 ms·
It does, but it puts them in the %appdata%/Temp folder. Which can be deleted by disk space cleanup. I don't think there's a built-in to get unique names in arb
by LeifCarrotson 8y ago
It does, but it puts them in the %appdata%/Temp folder. Which can be deleted by disk space cleanup.
I don't think there's a built-in to get unique names in arbitrary folders, other than the idiomatic timestamp method described.
- brucedawson 8y agoWell, arguably putting the log files in the temp folder so that they get cleaned up would be an improvement - currently the log files are never cleared without user action, and most developers don't even know the log files are created. I suspect that the other reason to not use some mktemp equivalent is that they wanted the names to have some logical order to them, it just turns out that ascending file numbers is a bad way to do this.
- electroly 8y agoYou have it backwards. GetTempFileName() only gives you unique names in arbitrary folders! If you want to use %APPDATA%\Temp, you have to call GetTempPath() yourself and pass that path into GetTempFileName().