xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_ArgString()

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

Syntax

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

Arguments

<cSwitch>
This is a character string holding the symbolic name of the internal command line switch to check.

Return

The function returns the value of the commad line switch as a character string. If <cSwitch> is not used at program invocation, the return value is NIL. When it has no value, a null string ("") is returned.

Description

An xHarbour application can be started with regular and internal command line switches, or arguments. Internal switches are prefixed with two slashes, while regular switches are not prefixed. HB_ArgString() retrieves the value of prefixed switches.

Info

See also:HB_ArgC(), HB_ArgCheck(), HB_ArgV(), PCount(), PValue()
Category: Debug functions , Environment functions , xHarbour extensions
Source:vm\cmdarg.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example retrieves the value of the command line switch TEST.
// The value is displayed, when the program is started as follows
// (the command line switch is case insensitive):
//
//   c:\xhb\test.exe  //TEST10
//   c:\xhb\test.exe  //test10

   PROCEDURE Main( ... )

      ? HB_ArgString( "TEST"  )  // result: 10
      ? HB_ArgString( "TEST1" )  // result: 0
      ? HB_ArgString( "TEST2" )  // result: NIL

   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe