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 关注
- 95 浏览
添加回答
举报
0/150
提交
取消