struct student
{
char column_name;
char datatype;
char nullor;
struct student *next;
};
struct student *create(void)
{
struct student *head;
struct student *p1,*p2;
int n;
int i;
char ch;
FILE *fp;
fp=fopen("c:\\create.txt","r");
ch=fgets(fp);\\*
while (ch!=EOF)
{
ch=fgets(fp);\\*
if(ch==';')
{
n=n+1;
}
}
rewind(fp);
while (ch!='(')
{
ch=fgets(fp);\\*
}
head=p1=p2=(struct student*)malloc(LEN);
fscanf(fp,"%s %s %s",p1->column_name,p1->datatype,p1->nullor);
for (i=0;i<=n-1;i++)
{
while (ch!=';')
{
ch=fgets(fp);\\*
}
if (ch==';')
{
p2=p1;
p1=(struct student*)malloc(LEN);
p2->next=p1;
}
}
p2->next=NULL;
return(head);
}
为什么会抱错,能不能帮我改改
4个C:\Program Files\Microsoft Visual Studio\MyProjects\064087\064087.cpp(46) : error C2660: 'fgets' : function does not take 1 parameters,分别在\\*处
----------------解决方案--------------------------------------------------------
fgetc not fgets
----------------解决方案--------------------------------------------------------
现在问题是运行后,编译没问题,就是一运行,程序会崩掉,不知道为什么
----------------解决方案--------------------------------------------------------