I have to use an old library which returns me information as char arrays, for example char[9] to represent the time. All char arrays have trailing '\0', and the array space may not be fully used. For example , sometimes it returns char[9] with 9 '\0'. However when I log the char array using LOG_INFO<<time;, I get garbage log, especially for debug version. I temporarily walk around it by LOG_INFO<<std::string(time), so that I can get correct result for both debug and release versions, however this slows down the logger.
Could you suggest what could be wrong?
Hi,
I have to use an old library which returns me information as char arrays, for example char[9] to represent the time. All char arrays have trailing '\0', and the array space may not be fully used. For example , sometimes it returns char[9] with 9 '\0'. However when I log the char array using
LOG_INFO<<time;
, I get garbage log, especially for debug version. I temporarily walk around it byLOG_INFO<<std::string(time)
, so that I can get correct result for both debug and release versions, however this slows down the logger. Could you suggest what could be wrong?Thanks,