FILE 为什么用fwrite函数 txt中显示乱码啊?
#include <stdio.h>#include <stdlib.h>
#include <math.h>
main()
{ int i,j,n=0;
int a[50];
FILE *fp;
fp=fopen("file11.txt","w");
if(!fp) {printf("cannot open it!"); exit(0);}
for(i=500;i<800;i++)
for(j=2;j<sqrt(i);j++)
if(i%j==0)
break;
else if(j>sqrt(i)-1)
{ a[n]=i;
n++;}
fwrite(a,4,n,fp);
fclose(fp);
}