In C++ is there a way to go to a specific line in a text file?
Loop your way there. #include <fstream> #include <limits> std::fstream& GotoLine(std::fstream& file, unsigned int num){ file.seekg(std::ios::beg); for(int i=0; i < num – 1; ++i){ file.ignore(std::numeric_limits<std::streamsize>::max(),’\n’); } return file; } Sets the seek pointer of file to the beginning of line num. Testing a file with the following content: 1 2 3 4 5 6 7 8 … Read more