Reads a text file from disk and returns the text as an array of strings. ANSI, UTF-8 and Unicode encoded text files are supported.
Rhino.ReadTextFile (strFileName [, blnIgnoreEmptyRows [, blnTrimSpaces]])
strFileName |
Required. String. The name of an existing text file to read. |
blnIgnoreEmptyRows |
Optional. Boolean. If omitted or False (Default), then if an empty line is encountered in the text file, an empty element (vbEmpty) will be added to the string array. If True, then empty line will be skipped. |
blnTrimSpaces |
Optional. Boolean. If omitted or False (Default), then leading and trailing spaces, for each line of text that is read, will not be trimmed. If True, then leading and trailing spaces will be trimmed. |
Array |
An array of strings, if successful. |
Null |
On error. |
Dim strFile, arrText, i
strFile = Rhino.OpenFileName("Open", "Text Files (*.txt)|*.txt||")
If Not IsNull(strFile) Then
arrText = Rhino.ReadTextFile(strFile)
If IsArray(arrText) Then
For i = 0 To UBound(arrText)
Call Rhino.Print(arrText(i))
Next
End If
End If