TextBuffer.toFile Method

Saves the content of the TextBuffer object to a file.


public boolean toFile(str filename, [int encoding])

Run On



  • filename
    Type: str
    The name of file to write.
  • encoding
    Type: int

Return Value

Type: boolean
true if the operation is successful; otherwise, false.


If the specified file already exists, it is overwritten without confirmation.

If an attacker can control input to the toFile method, a security risk exists. Therefore, this method runs under Code Access Security. Calls to this method on the server require permission from the ExecutePermission class. Make sure that the user has development privileges by setting the security key to SysDevelopment on the control that calls this method.

See Also

TextBuffer Class

TextBuffer.fromFile Method