请教gcc编译下的几个警告该怎么去除,
gcc编译下的几个警告怎么去除
1.报165: warning: too many arguments for format
code:
#define OutLineNum(row, line, item) {、
char buf[60], buf2[10];\
if (item) {
sprintf(buf2, "(%d)", (item));\
sprintf(buf, "%5s", buf2);}\
else{
sprintf(buf, " ", (line)+1, (item));}\
}
调用处:
int line;
static int firstItemInCurrentPage=0;
OutLineNum(line, (line+firstItemInCurrentPage), 0); //此行报warning错误,不知道该怎么解决
2.报warning: embedded '\0' in format
snprintf(strtmp, sizeof(strtmp), ">\000");//此行报警告
3.报warning: array subscript has type 'char'
char string1[30];
char string2[30]="测试%s %2d测试%-11s";
char string3[10]="测试";
char string4[10]="测试";
static unsigned char WaiShe[MAX_OUTSIDEDEVICE];
unsigned char OutDeviceTypeData[MaxOutDeviceType][DeviceNameLen];
sprintf(string1, string2, string4, WaiShe[0],OutDeviceTypeData[id]);//此行报警告