Extracted from Pike v7.4 release 117 at 2004-11-02.
pike.ida.liu.se
[Top]
predef::
Stdio
Stdio.File

Method Stdio.File()->open()


Method open

int open(string filename, string mode)
int open(string filename, string mode, int access)
int open(int fd, string mode)

Description

Open a file or fd.

If access is not specified, it will default to 00666.

See also

close()


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