package mainimport ( "fmt" "os")func main() { f := "D:\\cron" fmt.Println(os.Stat(f)) fmt.Println(os.Open(f)) f = "D:\\con" fmt.Println(os.Stat(f)) fmt.Println(os.Open(f))}result:<nil> CreateFile D:\cron: The system cannot find the file specified.<nil> open D:\cron: The system cannot find the file specified.<nil> CreateFile D:\con: The parameter is incorrect.&{0xc000086a00} <nil>我認為當文件不存在時,os.Open 應該返回 err != nil但我想知道為什么“D:\con”返回 err == nil
- 1 回答
- 0 關注
- 118 瀏覽
添加回答
舉報
0/150
提交
取消