Oct 6, 2011, 11:44 AM
Post #1 of 2
So I have a file, which consists of multiple very long lines, so long that I don't want to read the entire line for memory concerns. And for each line, I want to count the number of some special character, let's call it X
Parsing extremely long lines
So a line could be:
....................X........blahlahblah....X...........X......., repeat 1 billion times.
So I have come up with 2 options:
1) pre process the lines and break them up into more manageable chunks. Then process line by line.
2) read a single character at time, do what's need when X is encountered, and go to the next character.
Which one is more efficient? Is there a better way?
(This post was edited by nfw on Oct 6, 2011, 11:46 AM)