Jump to content

Secure temporary file: Difference between revisions

Add NetRexx implementation
(Add Racket entry)
(Add NetRexx implementation)
Line 175:
<lang Mathematica>tmp = OpenWrite[]
Close[tmp]</lang>
 
=={{header|NetRexx}}==
<lang NetRexx>/* NetRexx */
options replace format comments java crossref symbols binary
 
runSample(arg)
return
 
-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
method makeTempFile(prefix = String, suffix = String null, startDir = String null) -
public static signals IOException returns File
if startDir \= null then fStartDir = File(startDir)
else fStartDir = null
ff = File.createTempFile(prefix, suffix, fStartDir)
ff.deleteOnExit() -- make sure the file is deleted at termination
return ff
 
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method runSample(arg) private static
do
tempFiles = [ -
makeTempFile('rexx'), -
makeTempFile('rexx', '.rex'), -
makeTempFile('rexx', null, './tmp') -
]
loop fFile over tempFiles
fName = fFile.getCanonicalPath()
say 'Temporary file:' fName
end fFile
catch ex = IOException
ex.printStackTrace()
end
return
</lang>
 
=={{header|OCaml}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.