1

我有以下方法内容:

FILE *file;
file = fopen("customers.dat", "w");
PList *list;
list = &customers;
fprintf(file, "%s", *(list->person.name));

fprintf 行给出的错误::

format '%s' expects argument of type 'char *', but argument 3 has type 'int' [-Wformat]

我有以下结构:

清单:

typedef struct PList{
    Person person;
    struct PList *nextPerson;  //  set to NULL by default <<<<<
}PList;

人:

typedef struct Person{
    char name[100]; // Left as "" if empty Person
    PersonID ID;
    float amountOwed;
}Person;

个人编号:

typedef struct PersonID{
    char letter;
    int number; // 7 digits
}PersonID;
4

1 回答 1

6

删除*

fprintf(file, "%s", *(list->person.name));
                    ^
于 2012-11-30T10:01:01.483 回答