September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,32 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
f, err := ioutil.TempFile("", "foo")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
// We need to make sure we remove the file
|
||||
// once it is no longer needed.
|
||||
defer os.Remove(f.Name())
|
||||
|
||||
// … use the file via 'f' …
|
||||
fmt.Fprintln(f, "Using temporary file:", f.Name())
|
||||
f.Seek(0, 0)
|
||||
d, err := ioutil.ReadAll(f)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Printf("Wrote and read: %s\n", d)
|
||||
|
||||
// The defer statements above will close and remove the
|
||||
// temporary file here (or on any return of this function).
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
def file = File.createTempFile( "xxx", ".txt" )
|
||||
|
||||
// There is no requirement in the instructions to delete the file.
|
||||
//file.deleteOnExit()
|
||||
|
||||
println file
|
||||
Loading…
Add table
Add a link
Reference in a new issue