Tuesday, 15 July 2014

go - How to convert memory address (like 0xc20803a000) to string? Golang -



go - How to convert memory address (like 0xc20803a000) to string? Golang -

i think question quite self-explained. want know how can convert memory address 0xc20803a000 string type. possible?

you can utilize fmt.sprintf(), %p (base 16 notation, leading 0x)

mystring := fmt.sprintf("%p", yourpointer)

fmt.sprintf() returns string.

you can see several examples (of printing memory pointer) in:

"how print pointer value of go object? pointer value mean?". "go example: string formatting".

replace in examples printf sprintf, , have string use.

memory go

No comments:

Post a Comment