在函数'displayBox'中:警告:格式参数太多[-Wformat-extra-args]

时间:2016-11-27 01:08:48

标签: c

我收到此错误,我不明白为什么。 w9_in​​_lab.c:在函数'displayBox'中:w9_in​​_lab.c:194:4:警告:格式参数太多[-Wformat-extra-args]

void displayBox(const char filename[], int id2Find)
{
FILE * fp = NULL;
struct Box b;
int record = 2;
fp = fopen("storage.txt", "r");
if (fp != NULL)
{
    searchBox(fp, id2Find);
    rewind(fp);
    fscanf(fp, "%d %lf %lf %lf %lf", &b.id, &b.size[0], &b.size[1], &b.size[2], &b.weight);
    while (b.id != id2Find && fscanf(fp, "%d %lf %lf %lf %lf", &b.id, &b.size[0], &b.size[1], &b.size[2], &b.weight) != EOF)
    {
        fscanf(fp, "%d %lf %lf %lf %lf", &b.id, &b.size[0], &b.size[1],    &b.size[2], &b.weight);
        record++;
    }
    fclose(fp);
    if (b.id == id2Find)
    {
        printf("Found box %d as record #%d\n", id2Find, record);
        printBox(b);
    }
    else
    {
        printf("This box is not recorded.\n\n", id2Find, record);
    }
 }

 else
 {
    printf("Error opening file");
 }
 }

0 个答案:

没有答案