改为以下就可以了。
#include <stdio.h>
int a[2];
void main()
{
int i;
int readdat(void);
void writedat(void);
readdat();
writedat();
for (i=0;i<2;i++)
printf("%d",a[i]);
}
int readdat(void)
{
int i = 0;
FILE *in;
in=fopen("F:\\in.txt","r");
for (i=0;i<2;i++)
fscanf(in,"%d",&a[i]);
fclose(in);
}
void writedat(void)
{
int i = 0;
FILE *out;
out=fopen("F:\\out.txt","w");
for (i=0;i<2;i++)
fprintf(out,"%d",a[i]);
fclose(out);
}