![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
PFO Founder
![]() ![]() |
Ok anyway what im wondering is would this end up being easier to put each line read in into its own level of an arrary or would it be easier to just go thought the text and find the end of line and then go from there.
well ok i have to take the data i read in from a file and replace all the chr(10) characters with with chr(13) & chr(10) this way it is readable in windows since the file is a linux file. but when i do this i just replace the 10 with the 13 & 10 would it be easier and probably more optimized to instead just when ever i find a chr(10) to just cut it off right there and put that line into its own level of the array? that when when i manipulate the lines later i dont have to search for the chr(13) & chr(10) again i just have to call the array level i want. would this be the smarter way around this or will it slow my program down? thanks for you help right now i am not using the array but if it would be better off i will change my code to use an array. thanks again
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#3 |
|
PFO Founder
![]() ![]() |
You have hit pretty much exactly what i was talking about right on the head. So i will probably stick with the way im am currently goin about this
thanks for the reply. ![]()
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|