Command-line argument parsing

This is an old revision of this page, as edited by Davnor (talk | contribs) at 14:33, 6 May 2010 (Tagged as new page, to allow time for expansion.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Different Command-line argument parsing methods are used by different programming languages to parse command-line arguments.

Programming languages

C

C uses argv to process command-line arguments.[1]

Java

An example of Java argument parsing would be:

public class Echo {
    public static void main (String[] args) {
        for (String s: args) {
            System.out.println(s);
        }
    }
}

PHP

PHP uses argc as a count of arguments and argv as an array containing the values of the arguments.[2] For example:

var_dump($argv);

References