#include <stdio.h>#include <stdlib.h>main(){int i,num[10];FILE *fr,*fw;if((fr=fopen ( "in.txt","r"))==NULL){printf("can't open file: in.txt\n");exit(0);}if((fw=fopen ( "out.bin","wb"))==NULL){printf("can't open file: res.dat\n");exit(0);}for(i=0;i<10;i++){fscanf(fr,"%d",&num[i]);}for(i=0;i<10;i++) fwrite(&num[i],sizeof(int),1,fw);fclose(fr);fclose(fw);}
- 2 回答
- 0 关注
- 77 浏览
添加回答
举报
0/150
提交
取消