FUNCTIONS CORE

ArgC()

Return the number of command-line arguments

Syntax

Signature
ArgC() --> nArgumentCount

Arguments

None.

Return value

A non-negative integer giving the number of arguments following the program name.

Description

Returns the command-line argument count available to the entire program. The executable name at position zero is not included in the count. The result is zero when the program was started without additional arguments.

Notes

ArgC() accepts no arguments. ArgV( 0 ) returns the executable name, and ArgV( 1 ) through ArgV( ArgC() ) return the counted arguments.

Example

ArgC.prg
PROCEDURE Main()

   s_Check( "No additional arguments", ArgC(), 0 )

RETURN

STATIC PROCEDURE s_Check( cTitle, xResult, xExpected )

   QOut( cTitle + ": " + IIF( xResult == xExpected, "OK", "ERROR" ) )

RETURN

Output

No additional arguments: OK

See also