HB_ArgShift

HB_ArgShift

Updates HB_ARG*() parameter list removing the 1-st one and replacing it by others

Syntax

      HB_ArgShift( [<lProgName>] ) -> NIL

Argument

<lProgName> : If .T. first non internal parameter is moved to hb_argv(0) and all next are shifted.

Returns

NIL

Description

This procedure shifts command line argument each time called and can be used for implementing command line arguments by a loop.

Note

Each time HB_ArgShift() called, return value of HB_ArgC() decremented

Example

      // If command line is :  C:\temp>test.exe p1 p2 //p3 p4 p5
      lProgName := .F.
      nArgC := HB_ArgC()
      FOR nArgNo := 1 TO nArgC // HB_ArgC()     // Each time HB_ArgShift() called, return value of HB_ArgC() decremented
         ? nArgNo, HB_ArgV( 1 )
         HB_ArgShift( lProgName  )
      NEXT
      // Result  :
      // <lProgName>
      // .F.       .T.
      // --------- ---------
      // 1 p1      1 p1
      // 2 p2      2 p2
      // 3 //p3    3 //p3
      // 4 p4      4 //p3
      // 5 p5      5 //p3

Seealso

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.