If you're comfortable compiling C++, this should do the trick. Basically, I put each line of the file in a vector, and output it to a new file by using a reverse iterator.
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
int main()
{
std::vector<std::string> fileLines;
std::string currLine;
std::ifstream inFile("input.txt");
if (inFile.is_open())
{
while (inFile.good())
{
std::getline(inFile, currLine);
fileLines.push_back(currLine);
}
inFile.close();
}
else
{
std::cout << "Error - could not open input file!\n";
return 1;
}
std::ofstream outFile("output.txt");
if (outFile.is_open())
{
std::vector<std::string>::reverse_iterator rIt;
for (rIt = fileLines.rbegin(); rIt < fileLines.rend(); rIt++)
{
outFile << *rIt;
}
outFile.close();
}
else
{
std::cout << "Error - could not open output file!\n";
return 1;
}
return 0;
}
If the output file is missing line breaks between the lines, then change the outFile << *rIt;
to be outFile << *rIt << "\r\n";
so a line break is added (omit the \r
if you're on Unix/Linux).
Disclaimer: I have not tested this code (I wrote it real quick in Notepad), but it looks viable.