# Method Stdio.File()->open()

Method open

  `int open(string filename, string mode)`
  `int open(string filename, string mode, int mask)`

Description

  Open a file for read, write or append. The parameter mode should contain one or more of the following letters:

  `"r"` | Open file for reading.
  `"w"` | Open file for writing.
  `"a"` | Open file for append (use with `"w"`).
  `"t"` | Truncate file at open (use with `"w"`).
  `"c"` | Create file if it doesn't exist (use with `"w"`).
  `"x"` | Fail if file already exists (use with `"c"`).

  mode should always contain at least one of the letters `"r"` or `"w"`.

  The parameter mask is protection bits to use if the file is created. Default is `0666` (read+write for all in octal notation).

Returns

  This function returns `1` for success, `0` otherwise.

See also

  close(), create()