Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View 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

View 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();
}
}
}

View file

@ -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)

View file

@ -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)

View file

@ -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)>