diff options
author | Kurt <kurt.w.jung@gmail.com> | 2016-07-30 11:06:04 -0400 |
---|---|---|
committer | Kurt <kurt.w.jung@gmail.com> | 2016-07-30 11:06:04 -0400 |
commit | 9d37149a8b21e4566cca0c844d25a80769dbd302 (patch) | |
tree | ce1128a9020335884c2700eea5d502e69f47bf77 /internal/files/bin | |
parent | 11f22e6f7d4f331772e7999a14bb7ade23028f19 (diff) | |
parent | a7290bf6598b103a0fcdb5ce25182e83c00e881b (diff) |
Merge branch 'prsolucoes-master'
Diffstat (limited to 'internal/files/bin')
-rw-r--r-- | internal/files/bin/bin.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/files/bin/bin.go b/internal/files/bin/bin.go new file mode 100644 index 0000000..5b56313 --- /dev/null +++ b/internal/files/bin/bin.go @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "io/ioutil" + "os" +) + +func main() { + var buf []byte + var pos int + var b byte + var err error + buf, err = ioutil.ReadAll(os.Stdin) + if err == nil { + for _, b = range buf { + fmt.Printf("0x%02X, ", b) + pos++ + if pos >= 16 { + fmt.Println("") + pos = 0 + } + } + } + if err != nil { + fmt.Fprintf(os.Stderr, "%s\n", err) + } +} |