17 lines
512 B
Plaintext
17 lines
512 B
Plaintext
<code>mktemp</code>, <code>mkstemp</code>, <code>mkstemps</code> or <code>mkdtemp</code> are useful functions to create temporary files and directories. They accept a <code>template</code> parameter which defines the path where the file should be created and which should contain at least six trailing "X"s to ensure the uniqueness of the filename.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
mkstemp("/tmp/file_XXXX"); // Noncompliant
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
mkstemp("/tmp/file_XXXXXX"); // Compliant
|
|
----
|
|
|