FileInfo.Attach

Fore syntax

Attach(Path: String);

Parameters

Path - a path and a name of the file, with which an object of this class is linked.

Description

The Attach designer creates an object used to work with files and links it with a file, path to which is passed by the Path parameter.

Comments

A file specified in the Path parameter could be absent. The Exists method should be used to check presence of this file.

Example

Sub Main;

Var

File1: IFileInfo;

BynW: IBinaryWriter;

Begin

File1:=New FileInfo.Attach("c:\Work\1.txt");

If File1.Exists Then

BynW:=File1.AppendBinary;

BynW.WriteDateTime(DateTime.Now);

End If;

Dispose File1;

End Sub Main;

After executing this example, current date and time converted to a binary format are written into the end of the file 1.txt.

See also:

FileInfo