IOday2

 1.

  1 #include <stdio.h>
  2 #include <string.h>
  3 #include <stdlib.h>
  4 #include <myku.h>
  5 int main(int argc, const char *argv[])
  6 {
  7     FILE *p=fopen("ceshi.txt","r");
  8     if(NULL==p)
  9     {
 10         ERR_MSG("fopen");
 11         return -1;
 12     }
 13 
 14     char s[30];
 15     int count=0;
 16     while(fgets(s,sizeof(s),p)!=NULL)
 17     {
 18         count++;
 19     }
 20     printf("count=%d\n",count);
 21     fclose(p);
 22     return 0;
 23 }      

2.

  1 #include <stdio.h>
  2 #include <string.h>
  3 #include <stdlib.h>
  4 #include <myku.h>
  5 int main(int argc, const char *argv[])
  6 {
  7     FILE *p1=fopen("ceshi.txt","r");
  8     if(NULL==p1)
  9     {
 10         ERR_MSG("fopen");
 11         return -1;
 12     }
 13     FILE *p2=fopen("t.txt","w");
 14     if(NULL==p2)
 15     {
 16         ERR_MSG("fopen");
 17         return -1;
 18     }
 19 
 20     char c;
 21     while(fread(&c,sizeof(c),1,p1)!=0)
 22     {
 23         fwrite(&c,sizeof(c),1,p2);
 24     }
 25 
 26     fclose(p1);
 27     fclose(p2);                                                                                  
 28     return 0;
 29 }

3.xmind

 

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值