On 01/19/2017 02:00 AM, hui zhang wrote: > so the file seek does not work in bufio.Read ? >
It looks like this has been answered before: https://groups.google.com/forum/#!topic/golang-nuts/mOvX0bmJoeI You could also create another bufio.Reader after you seek like: rd := bufio.NewReader(fi) err = binary.Read(rd, binary.LittleEndian, &pi) fmt.Println(pi) fi.Seek(0, os.SEEK_SET )////????? rd = bufio.NewReader(fi) err = binary.Read(rd, binary.LittleEndian, &pi) fmt.Println(pi) If you look at the bufio.Reader struct, it doesn't appear to have a notion of where it is in the file -- it just contains a buffer, read and write positions within that buffer, etc. -ayan -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.