[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _itemGetNL()
 Retrieve a numeric long value from an item
------------------------------------------------------------------------------
 C Prototype

     #include "item.api"
     long _itemGetNL(
                      ITEM itmNumber
                    )

 Arguments

     itmNumber is the item from which to retrieve a long value.

 Returns

     The numeric contained within the item passed as a C-style long.

 Description

     The _itemGetNL() function is used to retrieve a numeric long from an
     item.  If the value contained within itmNumber is not a numeric, or is
     a numeric with the DOUBLE flag set (see _itemType()), then the results
     of calling this function will be unpredictable.

 Examples

   #include "clipdefs.h"
   #include "extend.api"
   #include "item.api"
   #include "fm.api"

   HIDE ITEM near _xMakeSub( USHORTP apSize, USHORT dims );

   /*
   *
   * MYARRAY()
   *
   * Just like ARRAY()!
   */
   CLIPPER MYARRAY(void)

   {
     ITEM      arrayP, elementsP;
     SHORT     i;
     BOOL      check;
     USHORT    pcount = PCOUNT;
     USHORTP    apSize;
     /* Check parameters - must be at least one and all */
     /* NUMERIC */
     if ( pcount )
     {
   /* CAUTION: _xgrab() will cause VM IE if there isn't */
   /* enough  memory */
       apSize = (USHORTP)_xgrab( pcount * sizeof( USHORT ) );
       /* store the parameters into apSize[] in */
       /* reverse order. */

       for (i = 0; i < pcount; i++)
       {
         elementsP = _itemParam( pcount-i );
         check = _itemType( elementsP ) == NUMERIC &&
             ( apSize[i] =
             (USHORT)_itemGetNL( elementsP ) ) <= 4096;
         _itemRelease( elementsP );
         if (!check)
           break;
       }
       /* If all of the parameters check out ...*/

       if( check )
       {
         arrayP = _xMakeSub( apSize, pcount );
         _itemReturn ( arrayP );
         _itemRelease( arrayP );
       }
       else
       {
     _itemRelease( _itemReturn( _itemNew( NULL ) ) ); }
       _xfree( apSize );
     }

             }

             HIDE ITEM near _xMakeSub( USHORTP apSize, USHORT dims )
             {
               ITEM   arrayP;
               ITEM   tempP;
               USHORT i;
               arrayP = _itemArrayNew( apSize[ --dims ] );
               if ( dims )
               {
                 for (i = 1; i <= apSize[ dims ]; i++)
                 {
                   tempP = _xMakeSub( apSize, dims );
                   _itemArrayPut( arrayP, i, tempP );
                   _itemRelease( tempP );
                 }
               }
               return (arrayP);
             }


 Files  Library is CLIPPER.LIB, header file is Item.api.


See Also: _itemGetND() _itemPutNL() _itemType()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson