21 lines
541 B
Plaintext
21 lines
541 B
Plaintext
== Why is this an issue?
|
|
|
|
``++mktemp++``, ``++mkstemp++``, ``++mkstemps++`` or ``++mkdtemp++`` are useful functions to create temporary files and directories. They accept a ``++template++`` 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
|
|
|
|
[source,cpp]
|
|
----
|
|
mkstemp("/tmp/file_XXXX"); // Noncompliant
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,cpp]
|
|
----
|
|
mkstemp("/tmp/file_XXXXXX"); // Compliant
|
|
----
|
|
|