我发出警告说我"从不兼容的指针类型中分配"当我试图用递归的方式创建一个带有一些细节的文件的链接列表时,在这段代码上:
Main.c:
t_file *get_stat(DIR *directory)
{
struct dirent *curfile;
t_file *new;
if ((curfile = readdir(directory)) == NULL)
return (NULL);
new->name = curfile->d_name;
new->rights = mls_rights(new->name);
new->hardlinks = mls_hl(new->name);
new->owner = mls_owner(new->name);
new->group = mls_group(new->name);
new->size = mls_size(new->name);
new->lastacctime = mls_lat(new->name);
new->lastmodtime = mls_lmt(new->name);
new->createtime = mls_ct(new->name);
new->next = get_stat(directory); //assignment from incompatible pointer type
return (new);
}
mls.h:
typedef struct s_file
{
char *name;
char *rights;
int hardlinks;
char *owner;
char *group;
long long size;
char *lastacctime;
char *lastmodtime;
char *createtime;
t_file *next;
} t_file;
我已经搜索了四个小时,而且我仍然没有找到任何内容,所以你能帮助我。