标题:文件打开写不进去
取消只看楼主
傻瓜笨笨1986
Rank: 1
等 级:新手上路
帖 子:29
专家分:3
注 册:2010-10-8
结帖率:77.78%
已结贴  问题点数:20 回复次数:0 
文件打开写不进去
#include<stdio.h>
#define N 10
main()
  {
      FILE *fp;
      int a[N],i,count,b[N]={0};
      printf("input%dnumbers",N);
     for(i=0;i<N;i++)
      scanf("%d",&a[i]);
     if(fp=(fopen("mydate","w+"))==NULL)
     {
        printf("can't open the file\n");
        return;
      }        
      count=fwrite(a,sizeof(int),6,fp);/*写不进去count也不等于6*/
      rewind(fp);
      if(fread(b,sizeof(int),6,fp)!=6);
      {
         printf("error");
         return;
      }
      fclose(fp);
      for(i=0;i<6;i++)
      printf("%d\n",b[i]);
   }
搜索更多相关主题的帖子: include return count file 
2011-07-04 19:42



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-344697-1-1.html




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

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