I need to convert the data format of an int16 to a string representing its hexadecimal value.
I have tried some hex converters but they change the data instead of changing the formatting. I need it to be a string representation of its hexadecimal value.
data := (data from buffer)
fmt.Printf("BUFFER DATA : %X
", data) // output print on screen D9DC (hex)
fmt.Println(("BUFFER DATA : ", string(data)) // output print on screen 55772 (dec)
fmt.Println(("BUFFER DATA : ", data) // output print on screen [?]
How can I convert the data format so it prints D9DC
with fmt.Println
?
Full code here https://play.golang.org/p/WVpMb9lh1Rx