I'm trying to do a socket server, but when I tried to pass numbers I got std::invalid_argument and I don't know why.I remade the code to make it more simple and here is:
```
std::string a = std::to_string(32);
char texto[5];
strcat(texto,a.c_str());
printf("%s", texto);//Isn't printing a string that you can convert to a number
std::string b = texto;
int s = std::stoi(texto);
std::cout << s;
```
I expect the output of 32, but i'm getting error.
Aucun commentaire:
Enregistrer un commentaire