File input/output

Can someone help me? im trying to make a save file for my app and i need to read a string from 3rd line of the text file.
The file contains:
1
2
3
1
0
This is the line i need to read.


How do i make the getline function to read exactly the third line?

( char name1[100];save.getline(name1,100); //Im using this)
Read the first two lines to move your position in the stream and then call getline for the third one.
Is using
save.ignore(2, '\n');
Ok?

It works with it, it firsts ignores 2 characters, then using
save.getline(name1,100);
reads the third line.
Topic archived. No new replies allowed.