Skip to content

Instantly share code, notes, and snippets.

@vladimirvivien
Last active September 13, 2017 16:10
Show Gist options
  • Save vladimirvivien/2f3fd66a5ef8b534ec072cfb40edcacc to your computer and use it in GitHub Desktop.
Save vladimirvivien/2f3fd66a5ef8b534ec072cfb40edcacc to your computer and use it in GitHub Desktop.
func main() {
// use an os.File as source for alphaReader
file, err := os.Open("./alpha_reader3.go")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
defer file.Close()
reader := newAlphaReader(file)
p := make([]byte, 4)
for {
n, err := reader.Read(p)
if err == io.EOF {
break
}
fmt.Print(string(p[:n]))
}
fmt.Println()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment