Read the file sequentially from beginning to end, counting lines as you go along. If you want to read the 2d line then you will have to read lines 1 and 2. It is not possible to skip to a specific line in a text file.
int i = 0;
int line = 0;
int number = 0;
char c = '\0';
//Make sure your file is opened in binary mode when manipulating file pointers
cout << "Enter line number to read from file: ";
cin >> number;
//Search character by character for new line
//Increment counter when "new lines" are found.
if(c == '\n')
}while(line != number && infile.good());
//Set 'get' ponter to beginning of desired line to read
//Get the line.
Like ancient dragon says, there is no real automatic way to find where you want to be in the file without reading your way through it. Unless you already no exactly how many characters each line contain, and they all will always contain the same about of characters at all times, then you can just seekg() to the specific line.. but this is a very rare case.
I am working creating a fully encapsulated, homogeneous singly linked data structure. The Listing class and SinglyLinkedList class that are part of the whole application compile fine, but the problem ...