c语言代码如下:
#include<stdio.h>
int main()
{
FILE* fp1;
FILE* fp2;
char str[1024];
fp1 = fopen("input.txt","r");
fp2 = fopen("output.txt","w");
while (1)
{
if (fgets(str,50, fp1) == NULL)
break;
fputs(str,fp2);
//printf("%s", str); //打印每行文件内容
}
fclose(fp2);
fclose(fp1);
return 0;
}