#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);
}
ITMISS
GCT1015
相关分类