I am working through a few small C++ projects, one of which is read the contents of a file (a few lines, say 1,2,3) and output them in reverse order to another file.
I am new to C++, and have looked through quite a few resources about getline, read, peek, etc etc but can't nail the problem on the head. I can retrieve the whole contents, the first line or the last line but can't get data line by line !
If someone could point me in the right direction as to the right commands and so forth, and how to grab and store the data in reverse order it would be greatly appreciated.
my code so far:
ifstream source ("liam.txt");
while (! source.eof() )
ofstream target ("output.txt");
target << buffer;