FILE*pOrigin, *pNew; printf("输入源文件名:"); gets(filename1); printf("输入目的文件名:"); gets(filename2); pOrigin =fopen(filename1,"rb"); pNew =fopen(filename2,"wb"); do{ fscanf(pOrigin,"%d %d", &a[0].V, &a[0].T); fscanf(pOrigin,"%d %d", &a[2].V, &a[2]....
int main(){ FILE *fp,*fpn; //创建文件指针fp和fpn int a[10],b[10],i,j,temp; //a数组用来存入数据 b数组用来接受文件数据进行重新排序输出 for(i = 0; i < 10; i++){ a[i] = i; //初始化赋值 } if((fp = fopen("data.dat","wb")) == NULL) //...
直接用fopen打开文件,用fwrite读取文件内容就行,类似于:FILE* fp1 = fopen("xxx.prn", "r+");if(fp){ fwrite(buf, sizeof(buf), 1, fp1);} 这样读出来的值就存入数组buf中了,不明白继续追问
int x,y,z;fscanf(p, "%d%d%d", &x, &y, &z);printf("Read:\nx=%d, y=%d, z=%d\n", x, y, z);fclose(p);
insert_new_elsement.c #includetypedef struct{ int V; int T; }V2T_T, *V2T_PT; int main() { int i; V2T_T a[3], b[2]; char filename1[80], filename2[80]; FILE *pOrigin, *pNew; printf("输入源文件名:"); gets(filename1); ...