What is the way to convert this int to a std::string. I have searched MSDN and found that itoa could be used (vs atoi for string to int as I know how it is done).
Though I cant find any good example that shows how itoa is used or if any other approach is possible.

int i = 5;

Recommended Answers

use stringstream

stringstream st;
st << i;
mystring = st.str();
Jump to Post

All 3 Replies

use stringstream

stringstream st;
st << i;
mystring = st.str();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.