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,399
  • 4
  • 24
  • 44

3 Answers3

2

intptr_t is just a number. Therefore:

Community
  • 1
  • 1
Jonathon Reinhart
  • 124,861
  • 31
  • 240
  • 314
2

Simple:

std::to_string(ip);

Well, simple if you have C++11.

Pete Becker
  • 72,338
  • 6
  • 72
  • 157
1
std::stringstream ss;
ss << ip;
ss.str();

(or if you prefer:

ss << std::hex << ip;

)

BoBTFish
  • 18,486
  • 3
  • 53
  • 76