12.3.91 SP_set_argv()


  since release 4.0.3

#include <sicstus/sicstus.h>

SP_set_argv(int argc,
	    char **argv,
	    spio_t_bits options);

Initializes the argv prolog flag.



The number of elements of the argv vector.


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.


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:

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.


See Also

Initializing the Prolog Engine.

Send feedback on this subject.