Previous Topic: memoRead--Read a Text File Into a String (Function)Next Topic: platform--Query Operating System Type (Function)


memoWrit--Write a String to a File (Function)

The memoWrit() function writes the content of a JavaScript string to a file.

Note: If the file exists, it can either replace the existing file or append the string to the existing string content.

The function has the following syntax:

memoWrit(sFileName, sString [, bAppend])
sString

Defines the string.

sFileName

Defines the name of a text file. If the specified file does not exist, the function raises an exception.

, bAppend

If set to true, the function adds the string to the given file.

The function returns with the number of bytes written to the specified file.

Note: If there are problems accessing the file, the function creates an exception.

Examples

Write a single-line text file:

memoWrit("file.txt", "First line\"); 

Append a second line to the existing file:

memoWrit("file.txt","Second line\", true);

See also:

memoRead--Read a Text File Into a String (Function)