[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _xvsize()
 Determine the size of a VM segment
------------------------------------------------------------------------------
 C Prototype

     #include "vm.api"
     USHORT _xvsize(
                     HANDLE hSegment
                   )

 Arguments

     hSegment is the VM segment handle returned by _xvalloc().

 Returns

     _xvsize() returns the size of the VM segment, in bytes.  The actual
     value returned is the original number of bytes specified in
     in _xvalloc() that created the segment.

 Description

     _xvsize() returns the size of the VM segment.  You can resize the
     segment if necessary using _xvrealloc().

 Examples

     .  The following example resizes a previously allocated segment:

        // CA-Clipper include files
        #include "vm.api"

        #define VR_SHRANK     1
        #define VR_GREW       2
        #define VR_NOCHANGE   3
        #define VR_ERROR      0

        // Prototype
        int VMResizeExample(HANDLE hSegment, unsigned uiNewSize);


        int VMResizeExample(HANDLE hSegment, unsigned uiNewSize)
        {
           int iResult = VR_ERROR;
           unsigned int uiOldSize;
           long lChange;

           uiOldSize = _xvsize(hSegment);

           // Attempt to resize and assign result
           //
           if (_xvrealloc(hSegment, uiNewSize, 0))
              {
              lChange = (_xvsize(hSegment) - uiOldSize);

              if (lChange > 0)
                 iResult = VR_GREW;

              if (lChange == 0)
                 iResult = VR_NOCHANGE;

              if (lChange < 0)
                 iResult = VR_SHRANK;
              }

           return (iResult);
        }

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


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