2

Possible Duplicate:
Easiest way to convert int to string in C++

Does anyone know how to do that conversion?

I need to concatenate a intptr_t type to a string, and therefore need to convert it.

It's not an int, as It's a 64 bit OS.

Correct me if I'm wrong Thanks

Community
  • 1
  • 1
Alon_T
  • 1,430
  • 4
  • 26
  • 47

3 Answers3

2

intptr_t is just a number. Therefore:

Community
  • 1
  • 1
Jonathon Reinhart
  • 132,704
  • 33
  • 254
  • 328
2

Simple:

std::to_string(ip);

Well, simple if you have C++11.

Pete Becker
  • 74,985
  • 8
  • 76
  • 165
1
std::stringstream ss;
ss << ip;
ss.str();

(or if you prefer:

ss << std::hex << ip;

)

BoBTFish
  • 19,167
  • 3
  • 49
  • 76