Show contents 

IO > IO Assembly Interfaces > IFileInfo > IFileInfo.AppendText

IFileInfo.AppendText

Syntax

AppendText: ITextWriter;

Description

The AppendText method opens a file for writing in a text format and puts a cursor to the end of a file.

Example

Sub UserProc;
Var
    File1: IFileInfo;
    TextW: ITextWriter;
Begin
    File1 := New FileInfo.Attach("c:\Work\1.txt");
    If File1.Exists Then
        TextW := File1.AppendText;
        TextW.Encoding := CodePage.UTF8;
        TextW.WriteDateTime(DateTime.Now);
    End If;
    Dispose File1;
End Sub UserProc;

After executing the example the current date and time converted into a text format are written to the end of the 1.txt file. UTF-8 encoding is used when working with file.

See also:

IFileInfo