I want to convert string to float. I used the function std::atof, but when i have a string of zero this does not work because the return number of std::atof is 0 if it was succesful. Some of the strings are not numbers. There for, with this code i wrote:
float att_valur_converted;
att_valur_converted = std::atof(m_pAttr->att_value);
if (att_valur_converted != 0.0){
sprintf(m_pAttr->att_value,"%.2f", att_valur_converted);
This will not work for zero. What can I do so this will work for zero? Thanks.