HB_ArgV

HB_ArgV

Retrieves the value of a command line argument

Syntax

      HB_ArgV( [<nPos>] ) --> cArgValue

Arguments

<nPos> : ordinal position of the command line argument to inspect

Returns

This function returns diffetrent values as character strings depending on [<nPos>] :

         Value         Return
         -----         -------
         NIL           Full file specification ( path + file name and estension of .exe file )
         zero          Same as NIL
         1             First argument in the command line
         2             Second argument in the command line
         ...
         >HB_ArgC()    Null String

Description

HB_ArgV() is used to retrieve the contents of command line arguments passed to an Harbour application when it is started. To ordinal position NIL or zero has a special meaning: it retrieves the full file specification of Harbour application (excecutable).

Example

      // If command line is :  C:\temp>test.exe p1 p2

        ? HB_ArgV()     // C:\temp\test.exe
        ? HB_ArgV( 0)   // C:\temp\test.exe
        ? HB_ArgV( 1 )  // p1
        ? HB_ArgV( 2 )  // p2
        ? HB_ArgV( 3 )  // ( Null String )

Seealso

HB_ArgC(), HB_ArgCheck(), HB_ArgString(), HB_ArgShift(), PCount(),HB_PValue(), HB_AParams()

HB_ArgString

HB_ArgString

Retrieves the vale of an internal switch set on the command line.

Syntax

      HB_ArgString( <cSwitch> ) --> <cValue>

Arguments

<cSwitch> : A string holding the symbolic name of of an internal switch

Returns

If exist <cSwitch> in command line, remain of this switch in the argument, else a null string

Description

There are two kind of internal switches : prefixed and regular. Prefixed internal switches always have two slashes as prefix. This function return value of a prefixed switch.

Example

      // If command line is :  C:\temp>test.exe p1 p2 //p3
      ? HB_ArgString( 'p' ) // 3

Seealso

HB_ArgShift(), HB_ArgC(), HB_ArgCheck(), HB_ArgV(), PCount(), HB_PValue(), HB_AParams()

HB_ArgCheck

HB_ArgCheck

Checks existence of an internal switch on the command line

Syntax

      HB_ArgCheck( <cSwitch> ) --> <lExists>

Arguments

<cSwitch> : A character string holding the symbolic name of of an internal switch

Return

.T. (true) when the command line include an internal switch, otherwise .F. (false)

Description

There are two kind of internal switches : prefixed and regular. Prefixed internal switches always have two slashes as prefix. This function tests existence of prefixed switches.

Note

Use function HB_ArgString() to retrieve the value of an internal command line switch

Example

      // If command line is :  C:\temp>test.exe p1 p2 //p3
      ? HB_ArgCheck( 'p' ) // .T.

Seealso

HB_ArgC(), HB_ArgV(), HB_ArgString(), HB_ArgShift(), PCount(), HB_PValue(), HB_AParams()

HB_ArgC

HB_ArgC

Returns the number of command line arguments

Syntax

      HB_ArgC() --> nArgCount

Returns

The function returns the number of command line arguments

Description

When an Harbour 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().

Example

      // If command line is :  C:\temp>test.exe p1 p2
      ? HB_ArgC() // 2

Seealso

HB_ArgV(), HB_ArgCheck(), HB_ArgString(), HB_ArgShift(), PCount(), HB_PValue(), HB_AParams()