| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 883 人关注过本帖
标题:求助:链表读出的问题???望达人解决!!!!
只看楼主 加入收藏
zemg
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-7-7
收藏
 问题点数:0 回复次数:0 
求助:链表读出的问题???望达人解决!!!!
void readfile(struct Input *head)
{
    struct Input *cur=NULL,*read=NULL;
        FILE *fp;
    if((fp=fopen("D:\\VC文件\\temp.txt","r"))==NULL)
    {
        printf("不能打开文件,请按任意键结束!\n");
        getch();
        exit(1);
    }
    
    if(head==NULL)
    {printf("无效\n");
    return;}
    else
    {
        cur=head;
        read=cur->next;
    }
    
        
    
    do
    {read=(struct Input *)malloc(sizeof(struct Input));
    //就这里老报错~!!!!问题我找到了 fread后面多了个=号
          接着问题又来了 读出来的多了一行相同的乱码
          问题又解决了 把 while(!EOF)就没问题了 为什么?
         
    fread=(read,sizeof(struct Input),1,fp);     
    printf("%d  %d  %d  %d  %d\n",read->No,read->record,read->sex,read->str2.year,read->str2.month);
    
    }while(!feof(fp));
    fclose(fp);
}

[[it] 本帖最后由 zemg 于 2008-7-7 22:04 编辑 [/it]]

[[it] 本帖最后由 zemg 于 2008-7-7 22:08 编辑 [/it]]
搜索更多相关主题的帖子: 链表 read Input struct cur 
2008-07-07 21:15
快速回复:求助:链表读出的问题???望达人解决!!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017390 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved