简单的文件读写
#include <stdio.h>#include <stdlib.h>void main(){ int x[6]={1,2,3,4,5,6},y[3]={7,8,9}; int i; FILE *fp; fp = fopen("test.txt","wb"); fwrite(y,sizeof(int),3,fp); fclose( fp ); fp = fopen( "test.txt","rb"); fread(x,sizeof(int),3,fp); for ( i=0; i<6; i++ ) printf("%d ",x[i]); printf("\n"); fclose( fp );}