I think question is quite self-explained. I want to know how can I convert memory address like this 0xc20803a000
to string type. Is it possible?
You can use fmt.Sprintf(), with %p (base 16 notation, with leading 0x)
myString := fmt.Sprintf("%p", yourPointer)
fmt.Sprintf()
returns a string.
You can see several examples (of printing a memory pointer) in:
Replace in those examples Printf
by Sprintf
, and you have a string for you to use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With