Move pointer to next line in .txt file
I'm trying to select a value at random from a .txt document. Each value is on a separate line (I understand that the computer interprets that as Value 1\nValue 2\n Value3).
Example.txt
Code:
WORD | SUBJECT
WORD | SUBJECT
WORD | SUBJECT
WORD | SUBJECT
I can pull the same word and subject without a problem. Is there anyway to randomly set the pointer to begin on a different line of the .txt file? Short of going through and finding all the pointer positions?
I've already initialized rand() to a truly random number using srand(time(NULL)). I just can't figure out a way to move to a random line and return the information.
To sum it up...is there anyway to move the pointer "vertically" by identifying '\n' chars?