FileOps.$writefile()

Function group Execute on client Platform(s)
FileOps NO All

Syntax

FileOps.$writefile(cFilePath, vVariable [,iEnc=kUniTypeUTF8, bBOM=kTrue, bReplace=kTrue])

Description

Writes the file cFilePath with the contents of variable vVariable. Returns an integer error code (zero for success): see the FileOps function error codes.

cFilePath (Character 100000000) The pathname of the file.

vVariable (Variant) The variable into which the file contents will be read. Binary or Character. If it is Character, the file contents are converted to Character using the encoding specified by the iEnc parameter.

iEnc (Integer 32 bit, default is kUniTypeUTF8) The encoding used to convert the file contents to Character. A kUniType… constant, not kUniTypeBinary or kUniTypeCharacter. Only used when vVariable is a Character variable.

bBOM (Boolean, default is kTrue) If true, and character data is to be encoded as Unicode, $writefile adds a Unicode Byte Order Marker at the start of the file.

bReplace (Boolean, default is kTrue) Specifies what occurs if the file already exists before calling FileOps.$writefile(). If bReplace is true FileOps.$writefile() replaces the file; if bReplace if false, FileOps.$writefile() returns an error.

See FileOps.$readfile().