是否可以使用 vsnprintf 从数组中的确切值开始打印? 例如,我想使用 vsnprintf 从数组中的第 25 个字符开始打印。 我可以只输入这段代码吗?
va_list args;
#define length 100
char debug[length];
va_start(args, fmt);
vsnprintf(debug[25], length, fmt, args);
a_debug(devh,debug);
va_end(args);
最佳答案
从第 25 个字符打印?您的意思是从第 25 个字节位置开始打印到 缓冲区?试试这个:
vsnprintf(debug + 25, length - 25, fmt, args);
关于c++ - vsnprintf 来自数组中的确切值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19106591/