E
exits funnel
Hello,
I'm trying to append the ascii representation of an integer to an stl
string and I'm having some trouble. I've got the following bits of code:
#include <string>
#include <cstdlib>
....
char buf[10];
itoa(14, buf, 10);
string m_name = "House #" + buf;
When I try to compile this, my compiler complains about 'itoa' being an
undeclared function and in fact grepping stdlib.h verifies that the
funcion is not to be found. I've been away from c for some time and am
now trying to learn c++. Two questions then:
1) Where can I find atoi or some equivalent function?
2) Is there an easier way to add an integer to the string?
Thanks in advance for any replies!
-exits
I'm trying to append the ascii representation of an integer to an stl
string and I'm having some trouble. I've got the following bits of code:
#include <string>
#include <cstdlib>
....
char buf[10];
itoa(14, buf, 10);
string m_name = "House #" + buf;
When I try to compile this, my compiler complains about 'itoa' being an
undeclared function and in fact grepping stdlib.h verifies that the
funcion is not to be found. I've been away from c for some time and am
now trying to learn c++. Two questions then:
1) Where can I find atoi or some equivalent function?
2) Is there an easier way to add an integer to the string?
Thanks in advance for any replies!
-exits