WriteTextFile

Writes an array of strings to a text file. ANSI, UTF-8 and Unicode encoded text files are supported.

Syntax

Rhino.WriteTextFile (strFileName, arrStrings [, blnAppend [, intEncoding]])

Parameters

strFileName

Required.  String.  The name of an existing text file to write.  

arrStrings

Required.  Array.  The array of strings to write to the text file.

blnAppend

Optional.  Boolean.  If omitted or False (Default), the file will be overwritten if it already exists. If True, then the will be appended to if it already exists.

intEncoding

Optional.  Number.  The text file encoding, where:

Value

Description

0

ANSI Encoding

1 (Default)

UTF-8 Encoding

2

UTF-16 Encoding

Returns

Boolean

True if successful, False otherwise.

Null

On error.

Example

Dim strFile, arrStrings(4)

arrStrings(0) = "Every"

arrStrings(1) = "good"

arrStrings(2) = "boy"

arrStrings(3) = "deserves"

arrStrings(4) = "fudge."

strFile = Rhino.SaveFileName("Save", "Text Files (*.txt)|*.txt||")

If Not IsNull(strFile) Then

  Call Rhino.WriteTextFile(strFile, arrStrings)

End If

Also See

ReadTextFile