获取当前文件名和函数名

inline const char* const_basename(const char* filepath)
{
const char* base = strrchr(filepath, '/');
#ifdef _WIN32 // Look for either path separator in Windows
if (!base)
base = strrchr(filepath, '\\');
#endif
return base ? (base + 1) : filepath;
}


#define ERROR_MSG_HEAD (std::string("[") + const_basename(__FILE__) + "(" + std::to_string(__LINE__) + ") " + __FUNCTION__ + "] ")

猜你喜欢

转载自www.cnblogs.com/gd-luojialin/p/11912295.html
今日推荐