Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 4th, 2004, 2:00 PM   #1
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,629
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
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.
big_k105 is offline   Reply With Quote
Old Aug 4th, 2004, 2:24 PM   #2
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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."
Infinite Recursion is offline   Reply With Quote
Old Aug 4th, 2004, 2:26 PM   #3
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,629
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
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.
big_k105 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:27 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC