|
I could be misinterpreting your inquiry.... so correct me if I am wrong in what you are trying to do (character substitution). The only way to ensure that you have file flexibility is to parse the file, line by line and as you encounter the target character, you replace it with the substitution character.
I understand your desire for optimization. However, if the file is small in size.. you will not notice a difference between a sequential read or a read from memory. Furthermore, in order to get the positions of the target characters into an array index, you will have to have a priming sequential read anyway. So in this regard, an initial line-by-line read and replacement would be the most beneficial method.
Ultimately, if you subset a line of a file into something outside of that file... you will loose any possibility for flexibility in that files growth, etc. For instance, what you have in dataLines[5]... will not always be in the same position in the data file and vice versa.
If this makes no sense or is way off base, throw out some more details so I can better grasp what you are up to.
__________________
http://jasonpowers.net
"There are a thousand hacking at the branches of evil to one who is striking at the root."
|