dimanche 29 avril 2018

Converting ascii to char

I have the following snippet

std::string encodedstr;
if(std::isdigit(encodedstr.at(i))) {
             num_of_times = encodedstr.at(i);
             std::cout << num_of_times << "\n";
         }

The output is :

52
51 

I tried to cast it to a char but the output didn't change

num_of_times = static_cast<char>(encodedstr.at(i));

I am on windows with mingw64 compiler

Aucun commentaire:

Enregistrer un commentaire