Posted: Thu Aug 01, 2002 4:29 am
Restored from previous forum. Originally posted by Art Sentinel.
Hi, has anyone had any experience with altering multi-line text within an external file using PureBasic? I am very eager to hear your excellent suggestions as to the fastest way to parse and manipulate such a file.
.
Here is what I am doing:
1. I have an external file named Folder.whtml. This file resides in the same directory as my executable. Within this file is the location of a data base folder I want any processed information stored in. (In this case, it is set to D:\Data Base\.)
2. Now, my exe access this .whtml file and finds out which directory to perform actions.
3. Next, it reads from a text file containing links I have added.
4. It converts this text file into an HTML equivalent.
5. It saves this new HTML version in the directory I specified using the .whtml configuration file.
.
That part was simple! (It works as I wanted.) But I have noticed a 3 second delay when processing ~400 kbs of freeware links on my 388mhz computer. This leads me to think that there must be a more optimized way to achieve the same results--and thus decreasing the time required to parse and manipulate the 10,000+ lines of data. I know many of you are highly creative and skilled programmers. I would greatly appreciate any friendly advice you could share with me, or any clever brainstorming ideas you think up.
What would be the fastest way to do this?
I have considered placing the HTML formating text within another text file (and not using WriteStringN statements). My application would then loop through each line and copy it to the final HTML file in that manner. While this would decrease the application size, and make future customization much easier, I do not see this being a solution to my speed-increasing puzzle. (I will however take that external HTML code approach on my completed project since it is a far wiser way to go. This code is merely for testing purposes right now--please forgive the messiness.)
.
.
.
.
Thank you for your help! Take care.
- Art Sentinel
http://www.artsentinel.net
--------------
Top Ten Reasons Not To Procrastinate:
Coming Soon...
Edited by - Art Sentinel on 01 August 2002 05:33:52
Hi, has anyone had any experience with altering multi-line text within an external file using PureBasic? I am very eager to hear your excellent suggestions as to the fastest way to parse and manipulate such a file.
.
Here is what I am doing:
1. I have an external file named Folder.whtml. This file resides in the same directory as my executable. Within this file is the location of a data base folder I want any processed information stored in. (In this case, it is set to D:\Data Base\.)
2. Now, my exe access this .whtml file and finds out which directory to perform actions.
3. Next, it reads from a text file containing links I have added.
4. It converts this text file into an HTML equivalent.
5. It saves this new HTML version in the directory I specified using the .whtml configuration file.
.
That part was simple! (It works as I wanted.) But I have noticed a 3 second delay when processing ~400 kbs of freeware links on my 388mhz computer. This leads me to think that there must be a more optimized way to achieve the same results--and thus decreasing the time required to parse and manipulate the 10,000+ lines of data. I know many of you are highly creative and skilled programmers. I would greatly appreciate any friendly advice you could share with me, or any clever brainstorming ideas you think up.
What would be the fastest way to do this?
I have considered placing the HTML formating text within another text file (and not using WriteStringN statements). My application would then loop through each line and copy it to the final HTML file in that manner. While this would decrease the application size, and make future customization much easier, I do not see this being a solution to my speed-increasing puzzle. (I will however take that external HTML code approach on my completed project since it is a far wiser way to go. This code is merely for testing purposes right now--please forgive the messiness.)
.
.
Code: Select all
;Test to parse a text file and then write a HTML file using the text obtained
;Art Sentinel
;July 29, 2002
;
;ILYLCBD
;
;Delcare Variables
WriteWhat$ = "text files\New Folder\test\"
DatabaseFolder$ = "Folder.whtml"
Content$ = ""
CreatedFile$ = ""
ReadText$ = "links.txt"
WriteFile$ = "links.sat"
Header$ = "][ - Freeware Links - ]["
BodyStart$ = ""
BodyEnd$ = ""
;Test for Database folder
If ReadFile(0, DatabaseFolder$)
DatabaseFolder$ = ReadString()
CloseFile(0)
EndIf
;Test for command line parameters
;Empty for now...
;Process parameters
;Empty for now...
;Write HTML file
CreatedFile$ = DatabaseFolder$ + WriteWhat$ + WriteFile$
If OpenFile(0, CreatedFile$)
WriteStringN("")
WriteStringN("")
WriteStringN(Header$)
WriteStringN(BodyStart$)
WriteStringN("")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ][ Â Â - ")
WriteStringN(" Saturday List - Â Â ][")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
If ReadFile(1, ReadText$)
Repeat
UseFile(1)
Contents$ = ReadString()
If Contents$ = ""
Contents$ = ""
Else
Contents$ = Contents$ + ""
EndIf
UseFile(0)
WriteString(Contents$)
Until Eof(1) 0
CloseFile(1)
EndIf
WriteStringN("")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" ")
WriteStringN(" ")
WriteStringN(" Â ")
WriteStringN(" Â ")
WriteStringN(" ILYLCBD")
WriteStringN("")
WriteStringN(BodyEnd$)
WriteStringN("")
CloseFile(0)
EndIf
;Finish up
End
.
Thank you for your help! Take care.
- Art Sentinel
http://www.artsentinel.net
--------------
Top Ten Reasons Not To Procrastinate:
Coming Soon...
Edited by - Art Sentinel on 01 August 2002 05:33:52