xyz wrote:
> I have a text file around 7GB includes 100 million lines...
> I want to read the data line by line when I approach my module..
>
> ie., when i read for the first time , my program shuld read only one
> line and when i read for the next time , my program shuld read only
> second line discarding first line..
I'm not sure what you mean by "first time" and "next time" - do you mean
subsequent read calls with the open file, or do you mean reading a line,
closing the file, then opening it again and now reading the 2nd line?
In the first case, I don't see the problem, because you just read one
line after another.
In the second case, you'll need to store a filepointer somewhere
(variable or config file) - to the position AFTER your last read (i.e.
the first byte of the succeeding line). Then when you re-open the text
file, just jump to that file pointer and continue reading.
For info on ftell & fseek, check the c++ reference:
http://www.cplusplus.com/reference/c...dio/ftell.html
Best Regards,
Lars