OpenBinaryWriter(FileName: String; Truncate: Boolean): IBinaryWriter;
FileName - a path and name of the file that should be opened.
Truncate - a parameter that determines whether a file is cleared during opening. True if it is.
The OpenBinaryWriter method opens a file for writing in a binary format and sets a cursor to the beginning of a file.
Sub Main;
Var
BinW: IBinaryWriter;
Begin
If File.Exists("c:\New_folder\1.txt") Then
BinW:=File.OpenBinaryWriter("c:\New_folder\1.txt",True);
BinW.WriteDateTime(DateTime.Now);
End If;
End Sub Main;
After executing this example, current date and time converted into binary format are written to the file 1.txt. The file is overwritten.
See also: