f, _ := os.Open("data.txt") offset := int64(50) buffer := make([]byte, 10) f.ReadAt(buffer, offset)
conn, _ := net.Dial("tcp", "127.0.0.1:8080") offset := int64(100) buffer := make([]byte, 20) conn.(*net.TCPConn).ReadFrom(buffer, offset)In this example, we connect to a network socket and read 20 bytes from an offset of 100. These examples are part of the standard library "io" package.