函数原型:
#include <stdio.h>
int fputs( const char *str, FILE *stream );
#include <stdio.h>
int main(void) {
FILE *file1;
FILE *file2;
char tmp[64];
char c;
file1 = fopen("test.c", "r");
file2 = fopen("test2.c", "w");
while (fgets(tmp, sizeof(tmp), file1) != NULL) {
fputs(tmp, file2);
}
fclose(file1);
fclose(file2);
return 0;
}