• 6.2 创建空目录


    
    package main
    
    import "io/ioutil"
    import "os"
    import "fmt"
    
    func main() {
    	tFile, err := ioutil.TempFile("", "gostdcookbook")
    	if err != nil {
    		panic(err)
    	}
    	// The called is responsible for handling
    	// the clean up.
    	defer os.Remove(tFile.Name())
    
    	fmt.Println(tFile.Name())
    
    	// TempDir returns
    	// the path in string.
    	tDir, err := ioutil.TempDir("", "gostdcookbookdir")
    	if err != nil {
    		panic(err)
    	}
    	defer os.Remove(tDir)
    	fmt.Println(tDir)
    
    }
    
    /*
    File name: test.file
    Is Directory: false
    Size: 18
    Mode: -rwxr-xr-x
    */
    
    
  • 相关阅读:
    NSString拼接字符串
    2020/4/26
    2020/4/25
    2020/4/24
    2020/4/22
    2020/4/22
    2020/4/20
    2020/4/19
    2020/4/18
    2020/4/17
  • 原文地址:https://www.cnblogs.com/zrdpy/p/8635642.html
Copyright © 2020-2023  润新知