github.com/phpdave11/gofpdf@v1.4.2/internal/files/bin/bin.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "io/ioutil" 6 "os" 7 ) 8 9 func main() { 10 var buf []byte 11 var pos int 12 var b byte 13 var err error 14 buf, err = ioutil.ReadAll(os.Stdin) 15 if err == nil { 16 for _, b = range buf { 17 fmt.Printf("0x%02X, ", b) 18 pos++ 19 if pos >= 16 { 20 fmt.Println("") 21 pos = 0 22 } 23 } 24 } 25 if err != nil { 26 fmt.Fprintf(os.Stderr, "%s\n", err) 27 } 28 }