FileInfo.Attach

Fore Syntax

Attach(Path: String);

Parameters

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

Description

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

Comments

The file specified in the Path parameter may be absent. Use the Exists method to check if the file exists.

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 the example, the current date and time converted to a binary format are written into the end of the 1.txt file.

See also:

FileInfo