Rhino.ReadTextFile command mystery

Hi everyone,

I have a little mystery here… The above code is my way to check that when I use Rhino.ReadTextFile I do get an array of text lines (arrText)… and usually it is the case.

But sometimes, the very same command used with the very same txtFile does not behave the same : the condition “isArray(arrText) becomes False” and of course my program stops here.

Do you have any clue why this happens ? The txt file and my code are both on my C:/

The code

The text file

Thanks for your help,
BR
Tanguy

Hi @tanguy.prevost,

Do you have a way of repeating this? Do you have the same issue if you read the file using a FileSystemObject?

Sub ReadTextFile()
  Dim objFSO, objFile, strFileName, strLine
  Const ForReading = 1
  strFileName = Rhino.OpenFileName("Open", "Text Files (*.txt)|*.txt||")
  If IsNull(strFileName) Then Exit Sub
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objFile = objFSO.OpenTextFile(strFileName, ForReading)
  While Not objFile.AtEndOfStream
    strLine = objFile.ReadLine
    Rhino.Print strLine
  Wend
  objFile.Close
  Set objFSO = Nothing
End Sub

– Dale