[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _itemPutC()
 Place a zero-terminated character value into an item
------------------------------------------------------------------------------
 C Prototype

     #include "item.api"
     ITEM _itemPutC(
                     ITEM itmChar,
                     BYTEP fpChars
                   )

 Arguments

     itmChar is the item into which you want to place the string.  If
     itmChar is NULL, _itemPutC() will create a new item.

     fpChars is the zero-terminated string to place into the item.

 Returns

     A new item reference containing the zero-terminated string passed.

 Description

     The _itemPutC() function is used to associate a zero-terminated string
     with an item.  Any previous value in itmChar will be destroyed.

     The data located at fpChars is copied into a new space associated with
     the item that is returned.  It is the programmer's responsibility to
     free the allocation of fpChars in whatever manner it was allocated.

     Note:  _itemPutC() must copy the intended string from your buffer at
     fpChars.  If fpChars is unusually large, _itemPutC() may cause a VM
     failure due to insufficient real memory to accomplish a large copy.
     Typically, this error would manifest itself as an internal error 5302.

     Caution!  Do not assume that the address in itmChar will be the
     same address returned by _itemPutC().

 Examples

     /*
     *  YesNo( lExpr ) -> cValue
     *
     *  Given a logical expression, returns the
     *  string "Yes" if true, and "No " if false.
     *
     */

     CLIPPER YesNo( void )
     {
        ITEM itmParam, itmCRet;

        // Warning: DGROUP!

        itmCRet = _itemPutC( NULL, "No " );

        if (PCOUNT > 0)
        {
           itmParam = _itemParam( 1 );
           if (_itemGetL( itmParam ))
              itmCRet = _itemPutC( itmCRet, "Yes");

           _itemRelease( itmParam );
        }

        _itemRelease( _itemReturn( itmCRet ) );
        return;
     }

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


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