Closed myrtleTree33 closed 1 year ago
With Arduino library, you can convert int to String using this :
String itoa(int arg) {
return String(arg);
}
Hi, I compiled this just now and it worked no problem. Perhaps paste in the complete code example demonstrating failure? Thanks!
#include <StandardCplusplus.h>
#include <sstream>
using namespace std;
string itoa(int arg)
{
stringstream aa;
aa << arg;
return aa.str();
}
void setup() {}
void loop() {}
Hello, how do I convert an int to a string using standardcplusplus?
I tried the conventional way of using stringstreams, but it gives an error:
std::string itoa(int arg) { stringstream aa; aa << arg; return aa.str();
}
The error reported is error: 'string' does not name a type.