Product Logo

CNS Menu

Dynamic Menus

Functions

CNSMenu_File_Write

NameCNSMenu_File_Write
Description

Writes data out to a file.

Return TypeText
FormatCNSMenu_File_Write ( Data ; File ; FileExistsAction ; CharacterSet ; LineEndingType ; IncludeUnicodeBOM )
Required Parameters
Data

The data to write.

File

The path and file name of the file to write.

Optional Parameters
FileExistsAction

Defines what happens if the file already exists:

CharacterSet

The character set for the file. [Default is UTF-8.]

LineEndingType

The type of line endings to use:

IncludeUnicodeBOM

If True, and the character set is a unicode set, and the file is being created, this will include a unicode byte order mark. [Default is False.]

Examples
Example 1

Writes the data "My Data" to the "Data.txt" file.

CNSMenu_File_Write ( "My Data" ; "~/Desktop/Data.txt" )
Example 2

Writes the data "My Data" to the "Data.txt" file and overwrites the file if it already exists.

CNSMenu_File_Write ( "My Data" ; "C:\Users\Bob\Desktop\Data.txt" ; "Overwrite" )
Example 3

Creates a new "Data.txt" file with the data "My Data" in it and backs up the existing "Data.txt" file. It also writes a unicode BOM to the file.

CNSMenu_File_Write ( "My Data" ; "~/Desktop/Data.txt" ; "Backup" ; "" ; "" ; True )