Use reinterpret_cast to cast from char pointer to integer : reinterpret_cast « Development « C++ Tutorial






#include <iostream>
using namespace std;

int main()
{
  int i;
  char *p = "This is a string";

  i = reinterpret_cast<int> (p); // cast pointer to integer

  cout << i;

  return 0;
}
4448256"








5.21.reinterpret_cast
5.21.1.Use reinterpret_cast to cast from char pointer to integer
5.21.2.Using reinterpret_cast: cast float to int