SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
May 3, 2005, 01:30 #1
- Join Date
- Mar 2005
- Posts
- 16
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
reading array elements from a txt file
hello,
i am able to read from a txt file and this is the code:
Code:Const fsoForReading = 1 Dim objFSO Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'Open the text file Dim objTextStream,i Set objTextStream = objFSO.OpenTextFile("C:\test\testingArrayElements.txt", fsoForReading) 'Display the contents of the text file Response.Write objTextStream.ReadAll objTextStream.Close Set objTextStream = Nothing Set objFSO = Nothing
my normal code which has an array and a for loop looks like this:
Code:Dim extracturlArr(4),i extracturlArr(1) ="http://pww.xray.ms.philips.com/cmt_..._682/2_682.html" extracturlArr(2)= "http://pww.xray.ms.philips.com/cmt_..._735/2_735.html" extracturlArr(3)= "http://pww.xray.ms.philips.com/cmt_..._640/2_640.html" extracturlArr(4)= "http://pww.xray.ms.philips.com/cmt_..._680/2_680.html" For i = 1 to 4 strRetVal = strRetVal+xObj.Retrieve(extracturlArr(i),Request_G ET,"","","") next
-
May 3, 2005, 07:28 #2
- Join Date
- Jan 2005
- Location
- New York City
- Posts
- 244
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
how can i loop the content of this txt file like an array?
A snippet from http://msdn.microsoft.com/library/de...threadline.asp
Code:Function ReadEntireFile(filespec) Const ForReading = 1 Dim fso, theFile, retstring Set fso = CreateObject("Scripting.FileSystemObject") Set theFile = fso.OpenTextFile(filespec, ForReading, False) Do While theFile.AtEndOfStream <> True retstring = theFile.ReadLine Loop theFile.Close ReadEntireFile = retstring End Function
Bookmarks