xHarbour Reference Documentation > Function Reference |
Returns the number of command line arguments.
HB_ArgC() --> nArgCount
The function returns the number of command line arguments.
When an xHarbour application is started, it can be passed arguments from the command line which are received by the initial routine of the application. HB_ArgC() determines this number of arguments. The contents of command line arguments can be retrieved with function HB_ArgV().
See also: | HB_ArgV(), PCount(), PValue() |
Category: | Debug functions , Environment functions , xHarbour extensions |
Source: | rtl\cmdarg.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example outlines the difference between PCount() and // HB_ArgC(). Command line arguments can be retrieved in the // start routine with PCount()/PValue(), or anywhere in a program // with HB_ArgC()/HB_ArgV() PROCEDURE Main( ... ) LOCAL i FOR i:=1 TO PCount() ? i, PValue(i) NEXT ? "-----------" Test() RETURN PROCEDURE Test LOCAL i FOR i:=1 TO HB_ArgC() ? i, HB_ArgV(i) NEXT RETURN
http://www.xHarbour.com