What's wrong with the stringstrem approach?
Try:
#include <iostream>
#include <sstream>
#include <string>
int main(){
int a=7;
const int *ptr=&a;
std::ostringstream oss;
oss << ptr;
std::string address_a = oss.str();
std::cout<<address_a<<std::endl;
}