Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert file need help with pseudo code 2

Status
Not open for further replies.

LikeThisName

Vendor
May 16, 2002
288
US
i would like to use FSO to open an XML document write a line then insert a text file then write some more lines then insert another text file.

is this possible?

i know how to open and write a file i just didn't know if there is a limitation to FSO as far as how many files I can have open and how to print one file into another.

LikeThisName <- ? Sorry It's Taken =)
 
I you are doing this in an XML, you should use the XMLDom object to insert nodes in the XML. Are you sure you want to use FSO?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
I don't know of a limitation (I'm sure there is one though, nothing is infinite in a computer). You could always test this by creating an fso object inside a loop, open a file for reading. Then create another loop to close all the fso's. Something like:
Code:
Dim fso, tstream
Dim fso_count

'alter this counter to your liking
fso_count = 20

Dim i
ReDim tstream(fso_count-1)
   Set fso = Server.CreateObject("Scripting.FileSystemObject")

For i = 0 to fso_count - 1
   Set tstream(i) = fso(i).OpentextFile("testfile.txt",1,False,0)
Next

Response.Write "I currently have " & fso_count & " file streams open for reading!"

'clean up
For i = 0 to fso_count -1
   tstream(i).Close
   Set tstream(i) = Nothing
Next
Set fso = nothing

Technically you could keep increasing the size of fso_count and find the threshold. I think personally I would set the counter to a number I could reaonably expect to need, make it do a ReadAll for each stream in the first loop (into a dummy variable), then use timer calls to see how long it took (maybe also keeping open task manager to watch CPU usage).

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
thank you both.
i was real close to using fso last week and making it work so i'll look into Tarwn's example to see results but I will blow it up and go with TomThumbKP's approach, since it's probably the best route as I am looking into it.

Thank you two so much for you feedback and code snippets.


LikeThisName <- ? Sorry It's Taken =)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top