summaryrefslogtreecommitdiff
path: root/internal/files/bin/bin.go
blob: 5b56313a7bfb23c726e76505803c1b26b6639c04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
	}
}