STRTOFILE()

Top  Previous  Next

Writes a string into a file.

Syntax

STRTOFILE( cData, cFilename )

Parameters

cData

String that is written to the file. Depending on the string and current Unicode support, the string might be converted. See the Remarks section for details.

 

cFilename

A file name into which the string is written. The file name must specified according to the rules of the operating system. You can specify a fully qualified name or a relative name. Relative file names are resolved relative to the current directory.

Return value

Returns the number of bytes that have been written. With Unicode support enabled the number bytes does not match the number of characters in the string.

Remarks

STRTOFILE() creates a Unicode file with UTF8 encoding when Unicode support is enabled. This occurrs independently on whether the string in cData is a Unicode or ANSI string. Despite writing in UTF-8 format no corresponding preamble is written to file.

 

Unicode strings are converted to ANSI string when Unicode mode is disabled. Any character that has not representation in the ANSI character set of the current code page is replaced with a question mark. To create binary files you must disable Unicode support and write an ANSI string into the file.

 

STRTOFILE() prompts the user to overwrite the file, if the file exists and SET SAFETY is ON.

Compatibility

Visual WebGUI: Even with SET SAFETY ON Guineu never prompts the user for confirmation and implicitely assumes that the user wants to overwrite the file.

See also

SET SAFETY

SYS(8000) - Unicode support