io
io包
type Reader interface{
Read(p []byte)(n int,err error)
}
type Writer interface{
Write(p []byte)(n int,err err)
}
for循环中一次读出文件
n := -1
for {
n, err = file.Read(bs)
if n== 0 || err == io.EOF{
fmt.Println("读取到了文件末尾,结束读取操作")
}
fmt.Println(string(bs[:n]))
}