Can anyone see why this code produces the string "0" when 0x00 is plugged into
it instead of 0x00.
It works fine with 0xff for example.
Code:template <typename CT, typename T> //PARAMETERIZED OVER CHARACTER AND NUMERIC TYPE TO BE CONVERTED std::basic_string<CT> CONVERT_TO_STRING(const T& t, std::ios_base & (*f)(std::ios_base&), const std::streamsize precision) { std::basic_ostringstream<CT> oss; oss.setf(std::ios::showbase); oss <<std::fixed<<std::setprecision(precision)<< f << t; return oss.str(); }; CONVERT_TO_STRING<char>(0x00, std::hex, 0)




Reply With Quote