Skip to content

Instantly share code, notes, and snippets.

@OllieReynolds
Last active July 3, 2016 23:15
Show Gist options
  • Save OllieReynolds/bf4aae0f0993e10051550def5dfcf2e0 to your computer and use it in GitHub Desktop.
Save OllieReynolds/bf4aae0f0993e10051550def5dfcf2e0 to your computer and use it in GitHub Desktop.
#include <fstream>
#include <deque>
#include <string>
int main() {
std::ifstream input;
input.open("C:/Users/Ollie/Desktop/Captures/Q.txt", std::ifstream::in);
std::string line;
std::deque<std::string> linesReversed;
while (input.good() && std::getline(input, line)) {
linesReversed.push_front(line);
}
// linesReversed now has lines from your file in reverse order :)
input.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment