Next: , Previous: , Up: The File Library   [Index]


13.7.2 The Open Functions

The functions close the file argument if it opened before attempting to (re)open it.

f_affix

file f_affix(file f, text path);

is f, opens the f object file for the path file reading

Same as ‘f_open’(f, path, ‘OPEN_READONLY’, ‘0’).

f_bind

file f_bind(file f, text path);

is f, opens the f object file for the path file writing

Same as ‘f_open’(f, path, ‘OPEN_WRITEONLY’, ‘0’).

f_create

file f_create(file f, text path, integer permissions);

is f, opens the f object file for the path file writing

Same as ‘f_open’(f, path, ‘OPEN_CREATE’ | ‘OPEN_TRUNCATE’ | ‘OPEN_WRITEONLY’, permissions).

f_dopen

file f_dopen(file f, integer d, integer bits);

is f, opens the f object file for the d file descriptor reading or writing

The bits argument specify the open mode and is the bitwise OR of some file open bits.

See File Open Definitions.

Exactly one of the ‘OPEN_READONLY’ and ‘OPEN_WRITEONLY’ need be specified. ‘OPEN_NONBLOCKING’ is the only other bit observed.

f_open

file f_open(file f, text path, integer bits, integer permissions);

is f, opens the f object file for the path file reading or writing

The ‘f_open’ semantics loosely follows the semantics of UNIX open function.

The bits argument specify the open mode and is the bitwise OR of some file open bits.

See File Open Definitions.

Exactly one of the ‘OPEN_READONLY’ and ‘OPEN_WRITEONLY’ need be specified.

If the file is to be created it will be created with the permissions permissions (in same way as the open(2) function, the permissions argument is passed unchanged as the third argument to the open(2) function).

f_stderr

file f_stderr(file f);

is f, opens the f object file for standard error writing

No new system file is created and no system file is closed when f is closed. Output is on unistd.h STDERR_FILENO.

While the output medium is the same the with program error (on which the ‘v_’ functions are writing) and with other files opened for standard error, the buffering is not (and if writing is done over multiple standard error interfaces and without sufficient flushing, the output may appear in a random order).

See The Output Library.

f_stdin

file f_stdin(file f);

is f, opens the f object file for standard input reading

No new system file is created and no system file is closed when f is closed. Input is from unistd.h STDIN_FILENO.

While the input medium is the same the with program input and with other files opened for standard input, the buffering is not (and if reading is done over multiple standard input interfaces, the input may appear out of order, as each interface may read ahead).

f_stdout

file f_stdout(file f);

is f, opens the f object file for standard output writing

No new system file is created and no system file is closed when f is closed. Output is on unistd.h STDOUT_FILENO.

While the output medium is the same the with program output (on which the ‘o_’ functions are writing) and with other files opened for standard output, the buffering is not (and if writing is done over multiple standard output interfaces and without sufficient flushing, the output may appear in a random order).

See The Output Library.


Next: , Previous: , Up: The File Library   [Index]