throwawayinvisible
throwawayinvisible

Reputation: 35

How to read a certain line from a file and read from that point below, in c++?

I have a txt file, with some numbers. Let's say I have these lines.

124

559

774

12

145

698

So there are 6 lines, let's say, I would like to read the file from 12 and below, is there a function in c++ that returns the cursor of the file? I don't know prior what are the values, I was just trying to explain what I would like to do. So for example if I would like to read the values 12, 145, 698, is it possible, and ignoring the prior values, not deleting.

Upvotes: 0

Views: 113

Answers (1)

Loki
Loki

Reputation: 606

You can use getline : http://www.cplusplus.com/reference/string/string/getline/ And call it in a loop to skip the first N lines.

Upvotes: 2

Related Questions