SP_fopen()
#include <sicstus/sicstus.h> spio_t_error_code SP_fopen( char const *pathname, void *reserved, spio_t_bits options, SP_stream **pstream);
Opens a file and creates a SICStus stream reading and/or writing to it.
SP_expand_file_name()
unless the option
SP_FOPEN_OPTION_NOEXPAND
is specified, in which case the
path must already have been expanded by SP_expand_file_name()
.
NULL
.
SP_FOPEN_OPTION_READ
SP_FOPEN_OPTION_WRITE
SP_FOPEN_OPTION_APPEND
SP_FOPEN_OPTION_BINARY
SP_FOPEN_OPTION_TEXT
SP_FOPEN_OPTION_AUTOFLUSH
flush_output/1
. In essence this ensures that the stream behaves
as if it were unbuffered.
SP_FOPEN_OPTION_INTERACTIVE
SP_FOPEN_OPTION_NOEXPAND
pathname
has already been expanded with
SP_expand_file_name()
or something similar. This implies that
pathname
is an absolute path. If this option is not
specified, pathname
is expanded with
SP_expand_file_name()
before use.
*pstream
will be set to the created
stream.
On success, *pstream
will be set to the created stream and
SPIO_S_NOERR
or some other success code returned.
On failure, some SPIO failure code will be returned. Error codes with
special meaning for SP_fopen()
:
SPIO_E_FILE_NOT_FOUND
SPIO_E_FILE_ACCESS
SPIO_E_OPEN_ERROR
Other error codes may also be returned.