回复 3楼 默看
#include <stdio.h>
#include <stdlib.h>
int
main()
{
FILE *fp,*fp1,*fp2,*fp3,*fp4;
char
a[4][10];
char ch;
int i,j=0,b;
fp=fopen("a.txt","r");
while(!feof(fp))
{
for(i=0;(ch=fgetc(fp))!='\n'&&!feof(fp);i++)
a[j][i]=ch;
a[j][i]='\0';
j++;
}
fclose(fp);
fp1=fopen("1.txt","w");
fp2=fopen("2.txt","w");
fp3=fopen("3.txt","w");
fp4=fopen("4.txt","w");
fprintf(fp1,"%s",a[0]);
fprintf(fp2,"%s",a[1]);
fprintf(fp3,"%s",a[2]);
fprintf(fp4,"%s",a[3]);
fclose;
}