Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use <a href="http://msdn.microsoft.com/en-us/library/hs3e7355%28v=vs.80%29.aspx" rel="nofollow"><code>_tempnam</code></a> <a href="http://msdn.microsoft.com/en-us/library/18x8h1bh%28v=vs.80%29.aspx" rel="nofollow"><code>tmpnam_s</code></a> to create a filename that doesn't exist yet, and then use <a href="http://msdn.microsoft.com/en-us/library/aa363855%28v=vs.85%29.aspx" rel="nofollow"><code>CreateDirectory</code></a> to create the directory. There's technically a race condition if you do this, in that another process could potentially create a file or directory with that name in the time in between when you generate the filename and when you create the directory, but the odds of that are rather unlikely. To protect against that, you can loop until you succeed.</p> <p>For recursively removing a directory tree, you can use <a href="http://msdn.microsoft.com/en-us/library/bb762164%28v=vs.85%29.aspx" rel="nofollow"><code>SHFileOperation</code></a>. Alternatively, you can do the directory traversal yourself with <a href="http://msdn.microsoft.com/en-us/library/aa364418%28v=vs.85%29.aspx" rel="nofollow"><code>FindFirstFile</code></a>/<a href="http://msdn.microsoft.com/en-us/library/aa364428%28v=vs.85%29.aspx" rel="nofollow"><code>FindNextFile</code></a>, <a href="http://msdn.microsoft.com/en-us/library/aa363915%28v=vs.85%29.aspx" rel="nofollow"><code>DeleteFile</code></a>, and <a href="http://msdn.microsoft.com/en-us/library/aa365488%28v=vs.85%29.aspx" rel="nofollow"><code>RemoveDirectory</code></a>.</p> <p>If you want to remove the directory automatically upon exiting, register a function using <a href="http://msdn.microsoft.com/en-us/library/tze57ck3%28v=vs.80%29.aspx" rel="nofollow"><code>atexit</code></a>. This will only work for normal program termination (i.e. via the <code>exit</code> function or via returning from <code>main</code>/<code>WinMain</code>). This will not work for abnormal program termination (e.g. via <code>abort</code>, an access violation, someone else calling <code>TerminateProcess</code>, etc.).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload