Equinox Online Help - Language Reference - A to Z

Home

FileWrite

Applies to
SyntaxFileWrite HandleItem, Item1[, Item2, Item3 ... ]
Action[Statement] Writes a list of items in internal Equinox format to a random file.
ScopeUsable anywhere
NotesThis statement writes items in internal format to a file from Equinox variables or fields. A list of mixed types can be written to the file in one operation. Strings are preceded by a 16-bit length and memos by a 32-bit length. This statement will not work if the file has been opened as a sequential file. The HandleItem parameter must be of Equinox variable type Handle and is the handle of the file which was opened with the FileOpen statement. After the statement has executed, SysReply contains the number of items written. The system workarea SysError is 1 if an error occurs, otherwise zero.
CategoryFile IO
See Also FileClose, FileCloseAll, FileDelimiters, FileInput, FileInputLine, FileLock, FileMovePosition, FileOpen, FilePosition, FilePrint, FileRead, FileReadLine, FileReadBinary, FileReadFile, FileUnlock, FileWrite, FileWriteBinary, FileWriteFile
Example

This example reads records from a table and creates a binary format file called LOG.DAT.

long reccount
handle hnd

| Open the file and test for error
FileOpen "LOG.DAT", RandomCreate, hnd

if hnd = -1 then
Alert "File Opening Error"
Exit Method
end if

reccount = CountRecords(TRANLOG)
FileWrite hnd,reccount

subtable Tranlog
SetIndex xTranNo
FirstRecord

while not syserror
FileWrite hnd, NextDate, NextTranNo
if syserror then exit while
nextrecord
end while
end subtable | Tranlog

FileClose hnd