Writing to/reading from files

May 31, 2013 at 5:49pm
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?
May 31, 2013 at 7:17pm
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
May 31, 2013 at 11:45pm
Thank you
Topic archived. No new replies allowed.