TextWriter.Create

Syntax

Create(Stream: IIOStream);

Parameters

Stream. The stream, to which text data is written.

Description

The Create constructor creates an object that enables the user to write data into a text file.

Comments

Specify the stream connected with the place, to which text data is written, as a value of the Stream parameter. Initialize the object of one of the following classes and specify it as a value of the Stream parameter:

Example

Sub UserProc;
Var
    f: IFileStream;
    TxtWriter: ITextWriter;
Begin
    f := New FileStream.Create("c:\File.txt", FileOpenMode.Create, FileShare.Exclusive);
    TxtWriter := New TextWriter.Create(f);
    TxtWriter.WriteLnString("***File Info***");
    TxtWriter.WriteString("Created:"); TxtWriter.WriteLnDateTime(DateTime.Now);
    TxtWriter.WriteString("Company:"); TxtWriter.WriteChar(#169); TxtWriter.WriteLnString("New Line");
    //...
    TxtWriter.Flush;
    Dispose f;
End Sub UserProc;

On executing the example the new text file File.txt is created. The specified character string is written into this file.

See also:

TextWriter