PDA

View Full Version : how to skip to read particular line in a file



iswaryasenthilkumar
1st April 2015, 13:30
am having text file inside the file am having multiple lines of text
Example
6000
aaa.jpg
bbn.jpg
ccc.jpg
here i want to read each line in a file i want to skip the first line (6000).how its possible in QTextstream or any other method to skip the particular line ??please give me suggestion:confused:
Thanks in advance:o

anda_skoa
1st April 2015, 14:05
Simple:

1) Read line
2) do nothing with it

Cheers,
_

Kryzon
5th April 2015, 22:40
An alternative is to use the seek function.
QTextStream::seek

anda_skoa
6th April 2015, 08:40
An alternative is to use the seek function.
QTextStream::seek

Yes and no.
seek() lets you skip over data, but it requires a position. You would need to know the position of the next line's end to seek to it.
Which, unless there is a fixed line length, means reading until you hit the newline marker.

Cheers,
_