TextWriter - Kirix Documentation

Developer Resources

TextWriter

Overview

The TextWriter class represents a file access stream for writing text data to a text file.

Methods

TextWriter.write
Writes text to a text file
TextWriter.writeLine
Writes a single line to a text file

Example

var text;

// try to create a text file
var writer = File.createText("c:\\testfile.txt");
if (writer)
{
    writer.writeLine("Line 1");
    writer.writeLine("Line 2");
    writer.writeLine("Line 3");

    writer.write("Line 4");
    writer.write(" - still on line 4");
    writer.writeLine(" - still on line 4");
    writer.writeLine("Line 5");
}

TextWriter.write

function TextWriter.write(text : String) : Boolean

Returns

True if the function succeeded, false upon failure.

Description

Write a single line to a file, but does not add any carriage return or line feed.

TextWriter.writeLine

function TextWriter.writeLine(text : String) : Boolean

Returns

True if the function succeeded, false upon failure.

Description

Write a single line to a file, ending it with a newline. The platforms text file format is respected, so on Windows systems, a carriage return and a line feed are added, but on Linux systems, only a newline character is added.