Equinox Online Help - Language Reference - A to Z

Home

FileWriteFile

Applies to
SyntaxFileWriteFile FileNameExpression, MemoItem
Action[Statement] Writes a file into from an Equinox memo.
ScopeUsable anywhere
Notes

This statement writes all the data, unformatted, from the item specified in the MemoItem parameter into the filename specified in FileNameExpression.

In order to write data to the server, prepend "SERVER:" (in any case) to the FileNameExpression. This prefix is ignored by the single user version. If the path specification is a relative one, it will start from the program directory - the Eqserver.exe directory for server files, and the Equinox.exe or Equinet.exe directory for everything else.

The system workarea SysError is set to 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 the contents of an HTML file, makes a backup of the file, changes all dates equal to a workarea LastUpdate and formatted like 24th January 21 to a new value contained in the workarea NextUpdate, then rewrites the file.

memo m
string yesterday, tomorrow

yesterday = StrDate(LastUdate, "%nth %m %0y")
tomorrow = StrDate(ThisUpdate, "%nth %m %0y")
path = "C:\HTMLFiles\Master.htm"

FileReadFile path, m

if not syserror then
FileWriteFile path & ".bak", m
Replace m, yesterday, tomorrow
FileWriteFile path, m
end if