VOOZH about

URL: https://www.geeksforgeeks.org/websites-apps/asp-openastextstream-method/

⇱ ASP OpenAsTextStream Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ASP OpenAsTextStream Method

Last Updated : 22 Mar, 2021

The ASP OpenAsTextStream Method is used to return a TextStream object by opening a specified file. It can be used to perform certain operations on the file.

Syntax:

FileObject.OpenAsTextStream(mode, format)

Parameters: This method has two parameters as mentioned above and described below:

  • mode: It specifies the mode that a file is opened in. It contains 3 constant values to perform operations on the file.
    • ForReading (1): This opens the file for reading. The file cannot be written in this mode.
    • ForWriting (2): This opens the file for writing.
    • ForAppending (8): This opens the file for appending content to the end.
  • format: Optional attribute. It contains three constant values which used to define a format of a file.
    • TristateFalse (0): This opens the file as ASCII. This is the default format.
    • TristateTrue (1): This opens the file as Unicode.
    • TristateUseDefault (2): This opens the file using the system default.

Example: The below code demonstrates the ASP File.OpenAsTextStream Method.

Output:

This is a GeeksforGeeks example
Comment
Article Tags: