警告可能出现的问题:
directive output truncated writing 16 bytes into a region of size 4 [-Wformat-truncation=]
warning: argument to ‘sizeof’ in ‘snprintf’ call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
note: assuming directive output of 4 bytes
出现了问题记录一下,防止脑子不好忘记了。
直接上代码看情况:
在main函数中调用了report_tempRH_json,传入buf,获取数据。但是获取的数据是不全的。
#include <stdio.h>
void report_tempRH_json(char *buf);
int main(int argc, char *argv[])
{
char temp_hum_buf[256];
report_tempRH_json(temp_hum_buf);
printf("temp_hum_buf:%s\n", temp_hum_buf);
return 0;
}
void report_tempRH_json</
5581



被折叠的 条评论
为什么被折叠?



