12.3.91 SP_set_argv()

Synopsis

     #include <sicstus/sicstus.h>
     
     int
     SP_set_argv(int argc,
     	    char **argv,
     	    spio_t_bits options);

Initializes the argv prolog flag.

Arguments

argc
The number of elements of the argv vector.
argv
A vector of strings that can be accessed by prolog_flag(argv,X). This argument is copied by SP_set_argv() so it can be discarded by the caller. May be passed as NULL if argc is zero.

The encoding used when converting the entries to atoms is determined by the options argument.

options
If options is zero then each entry in argv is assumed to be an encoded string, i.e. encoded using ‘UTF-8’. This is the same as passing argc and argv to SP_initialize() except that SP_initialize() will not report failure even if the argv entries are not suitable as atom names. Note that UTF-8 may not be the encoding used by the operating system when invoking main().

If options is SP_SET_ARGV_OPTION_SYSTEM_ENCODING then each entry in argv is assumed to be encoded using some system encoding. This is only useful on Unix-like systems since it is preferable, and trivial, to obtain and pass a UTF-8 argv vector on Windows.

The system encoding used by SP_set_argv() will be the first character encoding specified by the following environment variables:

SP_CTYPE
LC_ALL (only on Unix)
LC_CTYPE (only on Unix)
LANG (only on Unix)
if none of these are set then the operating system will be queried in some platform specific way.

Please note: For best results on Unix-like platforms you should use a locale based on UTF-8.

Return Value

Zero if the argument entries cannot be converted to atoms, and a nonzero value otherwise.

Description

See Also

Initializing the Prolog Engine.


Send feedback on this subject.