KVstorageBaseRaft-cpp icon indicating copy to clipboard operation
KVstorageBaseRaft-cpp copied to clipboard

util.h文件中format 格式化函数

Open beanljun opened this issue 6 months ago • 0 comments

类似于 printf 的功能,

首先,使用 'std::snprintf' 计算格式化后的字符串长度,加上 1 以包括终止符。

然后,根据计算的大小分配一个字符缓冲区,使用 'std::snprintf' 将格式化后的字符串写入缓冲区。

最后,将缓冲区内容转换为 std::string,并去掉终止符 \0,返回结果

测试截图: 5070734414

beanljun avatar Aug 05 '24 03:08 beanljun