Secure temporary file: Difference between revisions
Content added Content deleted
(→{{header|Kotlin}}: Change to use more secure method) |
|||
Line 395: | Line 395: | ||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="kotlin">import kotlin.io.path.createTempFile |
||
import kotlin.io.path.deleteExisting |
|||
fun main() { |
|||
import java.io.File |
|||
⚫ | |||
println("Temporary file created: $tempFilePath") |
|||
fun main(args: Array<String>) { |
|||
tempFilePath.deleteExisting() |
|||
try { |
|||
⚫ | |||
println(tf.absolutePath) |
|||
tf.delete() |
|||
} |
|||
catch (ex: Exception) { |
|||
println(ex.message) |
|||
} |
|||
}</syntaxhighlight> |
}</syntaxhighlight> |
||
Sample output |
Sample output: |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Temporary file created: /tmp/example14437465325231438926.tmp |
|||
/tmp/temp1551492276377305257.tmp |
|||
</pre> |
</pre> |
||