data.txt中内容如下:
aaaaaa
bbbbb
cccccc cc
dddd
eee eee
结果存储到data2.txt
eee eee
dddd
cccccc cc
bbbbb
aaaaaa
源代码如下:
reverse1.c
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE *fin, *fout1, *fout2;
char str[100];
int c;
if ((fin = fopen("./data.txt", "r")) == NULL)
{
printf("cannot open file!\n");
getchar();
exit(1);
}
if ((fout1 = fopen("./data1.txt", "w+")) == NULL)
{
printf("cannot open file!\n");
getchar();
exit(1);
}
if ((fout2 = f