Synonyms for argv or Related words with argv
Examples of "argv"
The name of the program,
, may be useful when printing diagnostic messages or for making one binary serve multiple purposes. The individual values of the parameters may be accessed with
, as shown in the following program:
) do |ff|
" argument is an array of character pointers. The last pointer in the array must be null to indicate the end of the list.
The "path" argument specifies the filename of the program to execute. For "spawnlp" and "spawnvp" only, if the filename does not have a path and is not in the current directory, the PATH environment variable determines which directories to search for the file. The string pointed to by "
" is the name of the program to run.
The argument specifies the path name of the file to execute as the new process image. Arguments beginning at "arg0" are pointers to arguments to be passed to the new process image. The "
" value is an array of pointers to arguments.
The parameters given on a command line are passed to a C program with two predefined variables - the count of the command-line arguments in argc and the individual arguments as character strings in the pointer array
. So the command:
the command 'FOO' will invoke FOO.EXE, and supply any additional arguments literally to the program, for example, "foo -v". This method is generally used for programs ported from Unix and other non-native systems; for C programs using argc and
More commonly, the desired command names are linked (using hard or symbolic links) to the BusyBox executable; BusyBox reads the zero element of
to find the name by which it is called, and runs the appropriate command, for example just
On UNIX implementations derived from AT&T UNIX, cp, ln and mv are implemented as a single program with hard-linked binaries. The behavior is selected from the last path component name in
. This is a common technique by which closely related commands that have been packaged as a unit allow the user to specify the particular course of intended action.
A basic example is in the
argument to the main function in C (and C++), which is given in the prototype as codice_67—this is because the variable codice_68 itself is a pointer to an array of strings (an array of arrays), so codice_69 is a pointer to the 0th string (by convention the name of the program), and codice_70 is the 0th character of the 0th string.
It is guaranteed that codice_12 is non-negative and that codice_24 is a null pointer. By convention, the command-line arguments specified by codice_12 and codice_13 include the name of the program as the first element if codice_12 is greater than 0; if a user types a command of "codice_28", the shell will initialise the codice_29 process with codice_30 and codice_31. As codice_32 is the name that processes appear under in codice_33, codice_34 etc., some programs, such as daemons or those running within an interpreter or virtual machine (where codice_32 would be the name of the host executable), may choose to alter their
to give a more descriptive codice_32, usually by means of the codice_37 system call.
A basic example of multiple pointer indirection is the
argument to the main function in C (and C++), which is given in the prototype as codice_5. The name of the invoked program executable, as well as all command line arguments that followed, are stored as independent character strings. An array of pointers to codice_6 contains pointers to the first character of each of these strings, and this array of pointers is passed to the codice_7 function as the codice_8 argument. The passed array itself "decays" to a pointer, thus codice_8 is actually a pointer to a pointer to codice_6, even though it stands for an array of pointers to codice_6 (similarly, the pointers in the array, while each formally pointing to a single codice_6, actually point to what are strings of characters). The accompanying codice_7 argument, codice_14, provides the size of the array (i.e. the number of strings pointed to by the elements of the array), as the size of an (outmost) array is otherwise lost when it is passed to a function and converted to a pointer. Thus, codice_8 is a pointer to the 0th element of an array of pointers to codice_6, codice_17, which in turn is a pointer to codice_18, a character (precisely, the 0th character of the first argument string, which by convention is the name of the program).
Copyright © 2017