Attach(Path: String);
Path - path and name of the file, with which an object of this class is linked.
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.
The file specified in the Path parameter may be absent. Use the Exists method to check if the file exists.
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: