OpenBinaryWriter(Truncate: Boolean): IBinaryWriter;
Truncate - parameter that determines whether the file is cleared while opening. If the value is True, the file is cleared.
The OpenBinaryWriter method opens a file for writing in a binary format and puts a cursor to the beginning of a file.
Sub UserProc;
Var
File1: IFileInfo;
BinW: IBinaryWriter;
Begin
File1:=New FileInfo.Attach("c:\Work\1.txt");
If File1.Exists Then
BinW:=File1.OpenBinaryWriter(True);
BinW.WriteDateTime(DateTime.Now);
End If;
Dispose File1;
End Sub UserProc;
After executing the example the current date and time converted into a binary format are written into the 1.txt file. The file is overwritten.
See also: