Writing to/reading from files

When using
1
2
3
ifstream file;
   file.open ("Data.txt");
   file >> variable;

Is there a way to specify the line number, or another way to make it possible to use a single file for multiple variables?
a) read all variables in order until you reach needed one.

b) If you know exactly position of needed variable, use seekg() to move to it:
http://en.cppreference.com/w/cpp/io/basic_istream/seekg
Thank you
Topic archived. No new replies allowed.