Method Stdio.File()->open()

Method open

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


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


Open file for reading.


Open file for writing.


Open file for append (use with "w").


Truncate file at open (use with "w").


Create file if it doesn't exist (use with "w").


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).


This function returns 1 for success, 0 otherwise.

See also

close(), create()