Read line by line into an array

Results 1 to 5 of 5

Thread: Read line by line into an array

  1. #1
    Shelz Guest

    Default Read line by line into an array

    I've read the article on reading lines of text into an array but I cannot get it to work... Has anybody else gotten it to work?

  2. #2
    <eop> Guest

    Default Yes


  3. #3
    Shelz Guest

    Default Here's my code... what's wrong?

    strpath2 = "\usa24servnetdevimport$\" & PS & ".out"<BR>function(strpath2)<BR> Set objFSO = _<BR> Server.CreateObject ("Scripting.FileSystemObject")<BR> If not objFSO.FileExists(strpath2) then<BR> Response.Redirect ("Tryagain.asp")<BR> Else<BR>Set objOpenFile = objFSO.OpenTextFile(strpath2,1)<BR> reDim myarray(0)<BR> i=-1<BR> While Not objOpenFile.AtEndofStream<BR> i=i+1<BR> Redim Preserve myarray(i)<BR> myarray(i)= objOpenfile.Readline<BR> wend

  4. #4
    Join Date
    Dec 1969

    Default What is function(strpath2) doing???

    That line makes no sense in the context you are showing.<BR><BR>Incidentally, doing ReDim Preserve every time through the loop is HORRIBLY SLOW coding! There are *MUCH* better ways.<BR><BR>Having said that, there is nothing obviously wrong with the code, except that the file you are specifying may not be accessible to the FSO *and* that function(...) line seems out of place.<BR><BR>What happens when you run the code? Any errors?<BR><BR>

  5. #5
    Shelz Guest

    Default RE: What is function(strpath2) doing???

    I guess it wasn&#039;t a function...I took those out and it did what I wanted... consequently... I read your part of the article and will implement it as soon as I&#039;ve tweaked the program... Thanks for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts