reverse a file character to another file

reverse a file character to another file

#include <stdio.h>
#include <iostream>
#include <fstream>
#include < string>
#include <stdlib.h>
using  namespace std;

int main() 

    ifstream fin("main.cpp");
    ofstream fout("a.cpp");
     string str;
     string filestr;
     char a[100];
     while(getline(fin,str))
    {
        filestr += (str + '\n');
    }
     int i = filestr.size();
     for( int i = filestr.size()-1; i>= 0; i--)
    {
        fout<<filestr[i];
    }

    system("pause");
     return 0;
}

你可能感兴趣的:(reverse a file character to another file)