cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
File input/output
File input/output
Nov 25, 2009 at 2:23pm UTC
award982
(129)
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)
Nov 25, 2009 at 2:29pm UTC
Bazzy
(6281)
Read the first two lines to move your position in the stream and then call getline for the third one.
Nov 25, 2009 at 2:34pm UTC
award982
(129)
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.