Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
6
Task/Secure-temporary-file/Go/secure-temporary-file-2.go
Normal file
6
Task/Secure-temporary-file/Go/secure-temporary-file-2.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
def file = File.createTempFile( "xxx", ".txt" )
|
||||
|
||||
// There is no requirement in the instructions to delete the file.
|
||||
//file.deleteOnExit()
|
||||
|
||||
println file
|
||||
|
|
@ -1,13 +1,15 @@
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
try {
|
||||
// Create temp file
|
||||
File filename = File.createTempFile("prefix", ".suffix");
|
||||
|
||||
// Delete temp file when program exits
|
||||
filename.deleteOnExit();
|
||||
|
||||
System.out.println(filename);
|
||||
|
||||
} catch (IOException e) {
|
||||
public class CreateTempFile {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
//create a temp file
|
||||
File temp = File.createTempFile("temp-file-name", ".tmp");
|
||||
System.out.println("Temp file : " + temp.getAbsolutePath());
|
||||
}
|
||||
catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
msg = "Rosetta Code, Secure temporary file, implemented with Julia."
|
||||
|
||||
(fname, tio) = mktemp()
|
||||
println(fname, " created as a temporary file.")
|
||||
println(tio, msg)
|
||||
close(tio)
|
||||
println("\"", msg, "\" written to ", fname)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
ENV["TMPDIR"] = pwd()
|
||||
(fname, tio) = mktemp()
|
||||
println(fname, " created as a \"temporary\" file.")
|
||||
println(tio, msg)
|
||||
close(tio)
|
||||
println("\"", msg, "\" written to ", fname)
|
||||
|
|
@ -6,3 +6,5 @@ irb(main):003:0> f.path
|
|||
=> "/tmp/foo20081226-307-10p746n-0"
|
||||
irb(main):004:0> f.close
|
||||
=> nil
|
||||
irb(main):005:0> f.unlink
|
||||
=> #<Tempfile: (closed)>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue