package main
import (
"os"
"bufio"
"fmt"
"io/ioutil"
)
func main() {
f,err := os.Open("b.txt")
if err != nil {
panic(err)
}
_,err= bufio.NewReader(f).Peek(64)
if err != nil {
panic(err)
}
r,err:=ioutil.ReadAll(f)
if err != nil {
panic(err)
}
fmt.Println(string(r))
}
it is written on the document that peek will not move the read position, so why is it that my code above does not read everything? But the rest of the content
peek how to understand?
here is the explanation of the peek function on the official website