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


11.7.2 The Open Functions

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

f_affix

void f_affix(file f, text path);

opens the f object file for the path file reading.

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

f_bind

void f_bind(file f, text path);

opens the f object file for the path file writing.

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

f_create

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

opens the f object file for the path file writing.

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

f_open

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

opens the f object file for the path file reading and/or writing (actually reading and writing is not supported, only 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_stdin

void f_stdin(file 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_stderr

void f_stderr(file 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_stdout

void f_stdout(file 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]