Reading Command-line Arguments
| Argument values | Argument counts | Program name / Script name | |
|---|---|---|---|
| C (C99) | argv | argc | first argument |
| Objective-C | |||
| C++ | |||
| C# | args | args.Length | Assembly.GetEntryAssembly.Location; |
| Java | args.length | ||
| D | first argument | ||
| JavaScript |
WScript.Arguments(n) | WScript.Arguments.length | WScript.ScriptName or WScript.ScriptFullName |
| Go | os.Args | len(os.Args) | first argument |
| Common Lisp | ? | ? | ? |
| Scheme (R6RS) | (list-ref (command-line) n) | (length (command-line)) | first argument |
| ISLISP | |||
| Pascal | ParamStr(n) | ParamCount | first argument |
| Visual Basic | Command | App.Path | |
| Visual Basic .NET | CmdArgs(n) | CmdArgs.Length | .GetEntryAssembly.Location |
| Python | sys.argv | len(sys.argv) | first argument |
| S-Lang | __argv | __argc | first argument |
| Fortran | DO i = 1,argc CALL GET_COMMAND_ARGUMENT (i,argv(i)) ENDDO | argc = COMMAND_ARGUMENT_COUNT | CALL GET_COMMAND_ARGUMENT (0,progname) |
| PHP | $argv | $argc | first argument |
| Perl | $ARGV | scalar(@ARGV) | $0 |
| Perl 6 | @*ARGS | @*ARGS.elems | $PROGRAM_NAME |
| Ruby | ARGV | ARGV.size | $0 |
| Windows PowerShell | $args | $args.Length | $MyInvocation.MyCommand.Name |
| OCaml | Sys.argv.(n) | Array.length Sys.argv | first argument |
| F# | args. | args.Length | Assembly.GetEntryAssembly.Location |
| Standard ML | List.nth (CommandLine.arguments , n) | length (CommandLine.arguments ) | CommandLine.name |
| Haskell (GHC) | do { args <- System.getArgs; return args !! n } | do { args <- System.getArgs; return length args } | System.getProgName |
- ^a The command-line arguments in Visual Basic are not separated. A split function Split(string) is required for separating them.
Read more about this topic: Comparison Of Programming Languages (basic Instructions)
Famous quotes containing the words reading and/or arguments:
“...what a thing it is to lie there all day in the fine breeze, with the pine needles dropping on one, only to return to the hotel at night so hungry that the dinner, however homely, is a fete, and the menu finer reading than the best poetry in the world! Yet we are to leave all this for the glare and blaze of Nice and Monte Carlo; which is proof enough that one cannot become really acclimated to happiness.”
—Willa Cather (18761947)
“Yesterday the Electoral Commission decided not to go behind the papers filed with the Vice-President in the case of Florida.... I read the arguments in the Congressional Record and cant see how lawyers can differ on the question. But the decision is by a strictly party voteeight Republicans against seven Democrats! It shows the strength of party ties.”
—Rutherford Birchard Hayes (18221893)